Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build dynamic tasks in my DAG (view of separate tasks) #169

Open
ciceromoura opened this issue Jun 26, 2023 · 0 comments
Open

Build dynamic tasks in my DAG (view of separate tasks) #169

ciceromoura opened this issue Jun 26, 2023 · 0 comments

Comments

@ciceromoura
Copy link

ciceromoura commented Jun 26, 2023

I would like to build dynamic tasks in my DAG, I have seen the functionality of expand_tasks, however I would like a different graph structure for my tasks in parallel, as in the Python code example below, which is something very common in Airflow

dag = DAG(dag_id='dynamic_dag', schedule_interval='0 0 * * *', start_date=datetime(2023, 1, 1))

table_names = ['table1', 'table2', 'table3']
dummy_task = DummyOperator(task_id='dummy_task', dag=dag)


for table_name in table_names:
    task = BashOperator(
        task_id=f'task_{table_name}',
        bash_command=f'echo "Processing {table_name}"',
        dag=dag
    )
    dummy_task >> task

DAG Graph generate:
image

Has anyone created something like this to support?

Or could we think of a feature for this case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant