You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/05/24 21:07:57 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #4603: [AIRFLOW-3717] Use DAG context managers in documentation examples

kaxil commented on a change in pull request #4603: [AIRFLOW-3717] Use DAG context managers in documentation examples
URL: https://github.com/apache/airflow/pull/4603#discussion_r287515538
 
 

 ##########
 File path: docs/tutorial.rst
 ##########
 @@ -54,36 +54,30 @@ complicated, a line by line explanation follows below.
         # 'end_date': datetime(2016, 1, 1),
     }
 
-    dag = DAG('tutorial', default_args=default_args, schedule_interval=timedelta(days=1))
+    with DAG('tutorial', default_args=default_args,
+             schedule_interval=timedelta(days=1)) as dag:
 
-    # t1, t2 and t3 are examples of tasks created by instantiating operators
-    t1 = BashOperator(
-        task_id='print_date',
-        bash_command='date',
-        dag=dag)
+        # t1, t2 and t3 are examples of tasks created by instantiating operators
+        t1 = BashOperator(task_id='print_date', bash_command='date')
 
-    t2 = BashOperator(
-        task_id='sleep',
-        bash_command='sleep 5',
-        retries=3,
-        dag=dag)
+        t2 = BashOperator(task_id='sleep', bash_command='sleep 5', retries=3_
 
 Review comment:
   ```suggestion
           t2 = BashOperator(task_id='sleep', bash_command='sleep 5', retries=3)
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services