huf-92 edited a comment on issue #17343:
URL: https://github.com/apache/airflow/issues/17343#issuecomment-900149194
@jedcunningham Thank you for your reply.
Removing <code>trigger.execute({})</code> causes that the self-triggering
process is not starting. Perhaps i described my self-triggering process in a
bad way. Below you see the TriggerDagRunOperator is wrapped by a function
called by a PythonOperator
and therefore the trigger.execute({}) is needed. Or is there a better way to
trigger the same DAG in function called by an operator ?
```python
trigger_dag = PythonOperator(
task_id="trigger_dag",
python_callable=_trigger_dag,
)
trigger_dag.doc_md = """triggers a new dag"""
def _trigger_dag():
if random_condition:
trigger = TriggerDagRunOperator(
task_id="trigger",
trigger_dag_id=dag_name,
conf={"group_nr": next_group_nr, "group": next_group},
)
trigger.execute({})
else:
return
```
--
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]