@@ -101,6 +101,16 @@ def printAllTopologicalOrders(graph, maxnumber=1):
101101
102102# <--- end code section for topological sorts
103103
104+ # find all tasks that depend on a given task (id)
105+ def find_all_dependent_tasks (possiblenexttask , tid ):
106+ daughterlist = [tid ]
107+ # possibly recurse
108+ for n in possiblenexttask [tid ]:
109+ daughterlist = daughterlist + find_all_dependent_tasks (n )
110+
111+ return list (set (daughterlist ))
112+
113+
104114# wrapper taking some edges, constructing the graph,
105115# obtain all topological orderings and some other helper data structures
106116def analyseGraph (edges , nodes ):
@@ -336,15 +346,6 @@ def getallrequirements(self, t):
336346 l = l + self .getallrequirements (r )
337347 return l
338348
339- # find all tasks that depend on a given task (id)
340- def find_all_dependent_tasks (self , tid ):
341- daughterlist = [tid ]
342- # possibly recurse
343- for n in self .possiblenexttask [tid ]:
344- daughterlist = daughterlist + self .find_all_dependent_tasks (n )
345-
346- return list (set (daughterlist ))
347-
348349 def get_done_filename (self , tid ):
349350 name = self .workflowspec ['stages' ][tid ]['name' ]
350351 workdir = self .workflowspec ['stages' ][tid ]['cwd' ]
@@ -674,7 +675,7 @@ def execute(self):
674675 if args .rerun_from :
675676 if self .tasktoid .get (args .rerun_from )!= None :
676677 taskid = self .tasktoid [args .rerun_from ]
677- self .remove_done_flag (self . find_all_dependent_tasks (taskid ))
678+ self .remove_done_flag (find_all_dependent_tasks (self . possiblenexttask , taskid ))
678679 else :
679680 print ('task ' + args .rerun_from + ' not found; cowardly refusing to do anything ' )
680681 exit (1 )
0 commit comments