ephraimbuddy commented on a change in pull request #16866:
URL: https://github.com/apache/airflow/pull/16866#discussion_r687488308



##########
File path: airflow/example_dags/example_xcom.py
##########
@@ -78,6 +104,14 @@ def puller(**kwargs):
     pull = PythonOperator(
         task_id='puller',
         python_callable=puller,
+        op_kwargs={
+            'pulled_value_1': push1.output['value from pusher 1'],
+            'pulled_value_3': push2.output,
+        },

Review comment:
       For me, I think we shouldn't show any example with PythonOperator. We 
should instead use TaskFlow API. However, whenever we have BashOperator and the 
likes, we should use context manager or `Operator(dag=dag)`. TaskFlow can be 
used inside context manager, for cases where we have a combination of 
PythonOperator and Other Operators:
   
   ```python
   with dag:
       task1 = BashOperator(task_id='myid', bash_command='sleep 1')
       
       @task
       def mypythontask(**kwargs):
           return 'xcom'
   
   task1 >> mypythontask()
   ```
   I feel we should stop using PythonOperator in examples.
   
   
   
        
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to