Skip to content

Commit e585084

Browse files
committed
pipeline runner: --rerun-from works with regular expressions
1 parent f97660a commit e585084

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

MC/bin/o2_dpg_workflow_runner.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,16 @@ def execute(self):
749749
exit (0)
750750

751751
if args.rerun_from:
752-
if self.tasktoid.get(args.rerun_from)!=None:
753-
taskid=self.tasktoid[args.rerun_from]
754-
self.remove_done_flag(find_all_dependent_tasks(self.possiblenexttask, taskid))
755-
else:
756-
print('task ' + args.rerun_from + ' not found; cowardly refusing to do anything ')
757-
exit (1)
752+
reruntaskfound=False
753+
for task in self.workflowspec['stages']:
754+
taskname=task['name']
755+
if re.match(args.rerun_from, taskname):
756+
reruntaskfound=True
757+
taskid=self.tasktoid[taskname]
758+
self.remove_done_flag(find_all_dependent_tasks(self.possiblenexttask, taskid))
759+
if not reruntaskfound:
760+
print('No task matching ' + args.rerun_from + ' found; cowardly refusing to do anything ')
761+
exit (1)
758762

759763
# *****************
760764
# main control loop
@@ -784,7 +788,7 @@ def execute(self):
784788
self.monitor(self.process_list) # ---> make async to normal operation?
785789
time.sleep(1) # <--- make this incremental (small wait at beginning)
786790
else:
787-
time.sleep(0.01)
791+
time.sleep(0.001)
788792

789793
finished = finished + finished_from_started
790794
actionlogger.debug("finished now :" + str(finished_from_started))
@@ -831,7 +835,7 @@ def execute(self):
831835
This condition is used as logical AND together with --target-tasks.', default=[])
832836
parser.add_argument('-tt','--target-tasks', nargs='+', help='Runs the pipeline by target tasks (example "tpcdigi"). By default everything in the graph is run. Regular expressions supported.', default=["*"])
833837
parser.add_argument('--produce-script', help='Produces a shell script that runs the workflow in serialized manner and quits.')
834-
parser.add_argument('--rerun-from', help='Reruns the workflow starting from given task. All dependent jobs will be rerun.')
838+
parser.add_argument('--rerun-from', help='Reruns the workflow starting from given task (or pattern). All dependent jobs will be rerun.')
835839
parser.add_argument('--list-tasks', help='Simply list all tasks by name and quit.', action='store_true')
836840

837841
parser.add_argument('--mem-limit', help='Set memory limit as scheduling constraint', default=max_system_mem)

0 commit comments

Comments
 (0)