josh-fell commented on a change in pull request #18562:
URL: https://github.com/apache/airflow/pull/18562#discussion_r720349141
##########
File path: airflow/example_dags/example_trigger_target_dag.py
##########
@@ -24,11 +24,12 @@
from datetime import datetime
from airflow import DAG
+from airflow.decorators import task
from airflow.operators.bash import BashOperator
-from airflow.operators.python import PythonOperator
-def run_this_func(dag_run):
+@task(task_id="run_this")
+def run_this_func(dag_run=None):
Review comment:
Actually this is supposed to be used in tandem with the
`example_trigger_controller_dag` DAG which triggers this DAG based on the
docstring:
```
"""
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
"""
```
Verified the "controller" DAG has the `TriggerDagRunOperator` sending a
`conf` arg:
```python
trigger = TriggerDagRunOperator(
task_id="test_trigger_dagrun",
trigger_dag_id="example_trigger_target_dag", # Ensure this equals
the dag_id of the DAG to trigger
conf={"message": "Hello World"},
)
```
Do you think it's still worth adding a simple check on
`dag_run.conf["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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]