You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/08/26 00:03:43 UTC

[GitHub] [airflow] ephraimbuddy commented on issue #25200: DAG Run fails when chaining multiple empty mapped tasks

ephraimbuddy commented on issue #25200:
URL: https://github.com/apache/airflow/issues/25200#issuecomment-1227870432

   Poked around this issue again and the code below resolved it:
   ```diff
   diff --git a/airflow/models/dagrun.py b/airflow/models/dagrun.py
   index 701618d5c4..55ca28b13e 100644
   --- a/airflow/models/dagrun.py
   +++ b/airflow/models/dagrun.py
   @@ -547,6 +547,9 @@ class DagRun(Base, LoggingMixin):
    
            leaf_task_ids = {t.task_id for t in dag.leaves}
            leaf_tis = [ti for ti in tis if ti.task_id in leaf_task_ids if ti.state != TaskInstanceState.REMOVED]
   +        
   +        if unfinished_tis:
   +            unfinished_tis = [t for t in unfinished_tis if t.state in State.unfinished]
    
            # if all roots finished and at least one failed, the run failed
            if not unfinished_tis and any(leaf_ti.state in State.failed_states for leaf_ti in leaf_tis):
   ```
   I ran the above dag several times with the change and it all succeeded(174 dagruns), however, I'm thinking it might not work on a faster machine. Maybe someone should try it. I think the better solution would be to move the mapped task expansion of last resort into the local task job


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org