Created
September 25, 2018 18:26
-
-
Save andscoop/8e946b10abfe3d9ad083a21fea0e9a8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example of sequential dynamic task creation | |
""" | |
from datetime import datetime, timedelta | |
from airflow import DAG, configuration | |
from airflow.operators.dummy_operator import DummyOperator | |
dag = DAG( | |
dag_id="dynamic_tasks_example", | |
start_date=datetime(2018, 2, 9), | |
schedule_interval='15 * * * *', | |
catchup=True, | |
) | |
start = DummyOperator( | |
task_id='start', | |
dag=dag | |
) | |
tasks = [start] | |
for t in ["task1", "task2", "task3"]: | |
taskOp = DummyOperator( | |
task_id=t, | |
dag=dag) | |
tasks[-1] >> taskOp | |
tasks.append(taskOp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment