Skip to content

Instantly share code, notes, and snippets.

@kinow
Created August 18, 2020 20:54
Show Gist options
  • Save kinow/5d1cdb7965d912d8540e3ed6830b8ef0 to your computer and use it in GitHub Desktop.
Save kinow/5d1cdb7965d912d8540e3ed6830b8ef0 to your computer and use it in GitHub Desktop.
DAG example workflows
from datetime import datetime
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
def print_hello():
return 'Hello world!'
# schedule_interval supports CRON syntax
dag = DAG('hello_world', description='Simple tutorial DAG',
schedule_interval='* * * * *',
start_date=datetime(2017, 3, 20), catchup=False)
dummy_operator = DummyOperator(task_id='dummy_task', retries=3, dag=dag)
hello_operator = PythonOperator(task_id='hello_task', python_callable=print_hello, dag=dag)
dummy_operator >> hello_operator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment