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:
[email protected]


With regards,
Apache Git Services

Reply via email to