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 2021/07/08 09:08:37 UTC

[GitHub] [airflow] ashb commented on a change in pull request #16866: Remove default_args pattern + added get_current_context() use for Core Airflow example DAGs

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



##########
File path: airflow/example_dags/example_trigger_target_dag.py
##########
@@ -24,23 +24,23 @@
 
 from airflow import DAG
 from airflow.operators.bash import BashOperator
-from airflow.operators.python import PythonOperator
+from airflow.operators.python import PythonOperator, get_current_context
 from airflow.utils.dates import days_ago
 
 
-def run_this_func(**context):
+def run_this_func():
     """
     Print the payload "message" passed to the DagRun conf attribute.
 
     :param context: The execution context
     :type context: dict
     """
+    context = get_current_context()
     print(f"Remotely received value of {context['dag_run'].conf['message']} for key=message")

Review comment:
       ```suggestion
   def run_this_func(dag_run):
       """
       Print the payload "message" passed to the DagRun conf attribute.
   
       """
       print(f"Remotely received value of {dag_run.conf['message']} for key=message")
   ```




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org