With this set, one can initialize the DAG as shown below. One pattern is to use the on_success_callback key on the default_args that get passed into the DAG class that initializes dag_a. Now, the question is where to fire the trigger for dag_b. execute ( context ) Triggering a DAG run from another TriggerDagRunOperator ( task_id = 'unique_dag_run_operator_id', trigger_dag_id = 'dag_b_id' ). This can then be used from within dag_a to call for a run of dag_b. This will be triggered in TriggerDagRunOperator during its initialization step in the following line: super(TriggerDagRunOperator, self)._init_(*args, **kwargs).Īt a bare minimum, we might represent a trigger of dag_b as the following. If you review the source code, it won’t be immediately obvious that this parameter is required.īut, if you review the source code for BaseOperator the abstract base class for TriggerDagRunOperator, you will see that a task_id is required for initialization.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |