@@ -774,23 +774,28 @@ def _check_if_run_in_progress(self) -> bool:
774774                            find_all_downstream_steps (failed_step , dag )
775775                        )
776776
777+                     # Combine failed steps and their downstream steps 
778+                     steps_to_skip .update (failed_steps )
779+ 
780+                     # Get the statuses of all steps that have run so far 
781+                     steps_statuses  =  {
782+                         s .name : ExecutionStatus (s .status )
783+                         for  s  in  self .step_runs 
784+                     }
785+ 
777786                    # Check if all non-skipped steps are finished 
778787                    for  step  in  steps :
779-                         # If it is a downstream step of a failed step, skip  
788+                         # If it is a failed step or a  downstream step of a failed step, continue  
780789                        if  step .config .name  in  steps_to_skip :
781790                            continue 
782- 
783-                         # If it is not in the step runs yet 
784-                         if  step .config .name  not  in   [
785-                             s .name  for  s  in  self .step_runs 
786-                         ]:
791+                         # If it is not in the step runs yet, it is in progress 
792+                         if  step .config .name  not  in   steps_statuses :
787793                            return  True 
788-                         # Else, check if it is finished 
789-                         elif  not  ExecutionStatus (
790-                             self .step_runs [step .config .name ].status 
791-                         ).is_finished :
794+                         # If it is in the step runs and is not finished, it is in progress 
795+                         elif  not  steps_statuses [step .config .name ].is_finished :
792796                            return  True 
793797
798+                     # Otherwise, it is not in progress 
794799                    return  False 
795800                else :
796801                    # No deployment, fallback to basic check 
0 commit comments