feluelle commented on a change in pull request #6317: [AIRFLOW-5644] Simplify 
TriggerDagRunOperator usage
URL: https://github.com/apache/airflow/pull/6317#discussion_r334251729
 
 

 ##########
 File path: airflow/example_dags/example_trigger_target_dag.py
 ##########
 @@ -18,65 +18,36 @@
 # under the License.
 
 """
-This example illustrates the use of the TriggerDagRunOperator. There are 2
-entities at work in this scenario:
-1. The Controller DAG - the DAG that conditionally executes the trigger
-   (in example_trigger_controller.py)
-2. The Target DAG - DAG being triggered
-
-This example illustrates the following features :
-1. A TriggerDagRunOperator that takes:
-  a. A python callable that decides whether or not to trigger the Target DAG
-  b. An optional params dict passed to the python callable to help in
-     evaluating whether or not to trigger the Target DAG
-  c. The id (name) of the Target DAG
-  d. The python callable can add contextual info to the DagRun created by
-     way of adding a Pickleable payload (e.g. dictionary of primitives). This
-     state is then made available to the TargetDag
-2. A Target DAG : c.f. example_trigger_target_dag.py
+Example usage of the TriggerDagRunOperator. This example holds 2 DAGs:
+1. 1st DAG (example_trigger_controller_dag) holds a TriggerDagRunOperator, 
which will trigger the 2nd DAG
+2. 2nd DAG (example_trigger_target_dag) which will be triggered by the 
TriggerDagRunOperator in the 1st DAG
 """
 
-import pprint
-
-import airflow
+import airflow.utils.dates
 from airflow.models import DAG
 from airflow.operators.bash_operator import BashOperator
 from airflow.operators.python_operator import PythonOperator
 
-pp = pprint.PrettyPrinter(indent=4)
-
-args = {
-    'start_date': airflow.utils.dates.days_ago(2),
-    'owner': 'Airflow',
-}
-
 dag = DAG(
-    dag_id='example_trigger_target_dag',
-    default_args=args,
+    dag_id="example_trigger_target_dag",
+    default_args={"start_date": airflow.utils.dates.days_ago(2), "owner": 
"Airflow"},
     schedule_interval=None,
 )
 
 
-def run_this_func(**kwargs):
+def run_this_func(**context):
     """
     Print the payload "message" passed to the DagRun conf attribute.
 
     :param dict kwargs: Context
 
 Review comment:
   ```suggestion
        :param context: The execution context
        :type context: dict
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to