@@ -34,6 +34,8 @@ def run(self, graph, config, updatehash=False):
3434 old_wd = os .getcwd ()
3535 notrun = []
3636 donotrun = []
37+ stop_on_first_crash = str2bool (config ["execution" ]["stop_on_first_crash" ])
38+ errors = []
3739 nodes , _ = topological_sort (graph )
3840 for node in nodes :
3941 endstatus = "end"
@@ -43,27 +45,28 @@ def run(self, graph, config, updatehash=False):
4345 if self ._status_callback :
4446 self ._status_callback (node , "start" )
4547 node .run (updatehash = updatehash )
46- except :
48+ except Exception as exc :
4749 endstatus = "exception"
4850 # bare except, but i really don't know where a
4951 # node might fail
5052 crashfile = report_crash (node )
51- if str2bool (config ["execution" ]["stop_on_first_crash" ]):
52- raise
5353 # remove dependencies from queue
5454 subnodes = [s for s in dfs_preorder (graph , node )]
5555 notrun .append (
5656 {"node" : node , "dependents" : subnodes , "crashfile" : crashfile }
5757 )
5858 donotrun .extend (subnodes )
5959 # Delay raising the crash until we cleaned the house
60- if str2bool ( config [ "execution" ][ "stop_on_first_crash" ]):
61- os . chdir ( old_wd ) # Return wherever we were before
62- report_nodes_not_run ( notrun ) # report before raising
63- raise
60+ errors . append ( exc )
61+
62+ if stop_on_first_crash :
63+ break
6464 finally :
6565 if self ._status_callback :
6666 self ._status_callback (node , endstatus )
6767
6868 os .chdir (old_wd ) # Return wherever we were before
6969 report_nodes_not_run (notrun )
70+ if errors :
71+ # Re-raise exception of first failed node
72+ raise errors [0 ]
0 commit comments