kukigai commented on a change in pull request #12126:
URL: https://github.com/apache/airflow/pull/12126#discussion_r521694146



##########
File path: airflow/operators/dagrun_operator.py
##########
@@ -126,3 +144,22 @@ def execute(self, context: Dict):
                 dag.clear(start_date=self.execution_date, 
end_date=self.execution_date)
             else:
                 raise e
+
+        if self.wait_for_completion:
+            # wait for dag to complete
+            while True:
+                self.log.info(
+                    'Waiting for %s on %s to become allowed state %s ...',
+                    self.trigger_dag_id,
+                    dag_run.execution_date,
+                    self.allowed_states,
+                )
+                dag_run.refresh_from_db()
+                state = dag_run.state
+                if state in self.failed_states:
+                    raise AirflowException(f"{self.trigger_dag_id} failed with 
failed states {state}")

Review comment:
       @turbaszek 
   
   Yes, I was thinking about that too.
   I will send separate PR once this is done.




----------------------------------------------------------------
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:
[email protected]


Reply via email to