diff --git a/docs/tutorial.rst b/docs/tutorial.rst index f7d4e15d56..3be2f7259d 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -52,11 +52,11 @@ complicated, a line by line explanation follows below. dag=dag) templated_command = """ - {% for i in range(5) %} - echo "{{ ds }}" - echo "{{ macros.ds_add(ds, 7)}}" - echo "{{ params.my_param }}" - {% endfor %} + {% for i in range(5) %} + echo "{{ ds }}" + echo "{{ macros.ds_add(ds, 7)}}" + echo "{{ params.my_param }}" + {% endfor %} """ t3 = BashOperator( @@ -94,13 +94,20 @@ of default parameters that we can use when creating tasks. from datetime import datetime - args = { + default_args = { 'owner': 'airflow', 'depends_on_past': False, - 'start_date': datetime(2015, 1, 1), - 'email': ['airflow@airflow.com',], - 'email_on_failure': True, - 'email_on_retry': True, + 'start_date': datetime(2015, 6, 1), + 'email': ['airflow@airflow.com'], + 'email_on_failure': False, + 'email_on_retry': False, + 'retries': 1, + 'retry_interval': timedelta(minutes=5), + # 'queue': 'bash_queue', + # 'pool': 'backfill', + # 'priority_weight': 10, + # 'schedule_interval': timedelta(1), + # 'end_date': datetime(2016, 1, 1), } For more information about the BaseOperator's parameters and what they do, @@ -137,7 +144,6 @@ instantiated from an operator is called a constructor. The first argument t2 = BashOperator( task_id='sleep', - email_on_failure=False, bash_command='sleep 5', dag=dag) @@ -241,20 +247,28 @@ something like this: """ from airflow import DAG from airflow.operators import BashOperator - from datetime import datetime + from datetime import datetime, timedelta default_args = { 'owner': 'airflow', 'depends_on_past': False, - 'start_date': datetime(2015, 1, 1), + 'start_date': datetime(2015, 6, 1), 'email': ['airflow@airflow.com'], 'email_on_failure': False, 'email_on_retry': False, + 'retries': 1, + 'retry_interval': timedelta(minutes=5), + # 'queue': 'bash_queue', + # 'pool': 'backfill', + # 'priority_weight': 10, + # 'schedule_interval': timedelta(1), + # 'end_date': datetime(2016, 1, 1), } dag = DAG('tutorial', default_args=default_args) + # t1, t2 and t3 are examples of tasks created by instatiating operators t1 = BashOperator( task_id='print_date', bash_command='date', @@ -262,22 +276,21 @@ something like this: t2 = BashOperator( task_id='sleep', - email_on_failure=False, bash_command='sleep 5', dag=dag) templated_command = """ - {% for i in range(5) %} - echo "{{ ds }}" - echo "{{ macros.ds_add(ds, 7)}}" - echo "{{ params.my_param }}" - {% endfor %} + {% for i in range(5) %} + echo "{{ ds }}" + echo "{{ macros.ds_add(ds, 7)}}" + echo "{{ params.my_param }}" + {% endfor %} """ t3 = BashOperator( task_id='templated', bash_command=templated_command, - params={'my_param': 'Parameter I passed in'}, + params={'my_param': 'Paramater I passed in'}, dag=dag) t2.set_upstream(t1)