You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pipeline runner: Ability to sync tasks with a 'semaphore' mechanism
Tasks can now specify a named semaphore object, meaning
that no two tasks refering to the same name may be executed
in parallel.
This is useful to achieve basic "critical section" protection, for instance
for merging operations (AOD).
self.tids_marked_toretry= [] # sometimes we might want to retry a failed task (simply because it was "unlucky") and we put them here
406
406
self.retry_counter= [ 0fortidinrange(len(self.taskuniverse)) ] # we keep track of many times retried already
407
+
self.semaphore_values= { self.workflowspec['stages'][tid].get('semaphore'):0fortidinrange(len(self.taskuniverse)) ifself.workflowspec['stages'][tid].get('semaphore')!=None } # keeps current count of semaphores (defined in the json workflow). used to achieve user-defined "critical sections".
407
408
408
409
defSIGHandler(self, signum, frame):
409
410
# basically forcing shut down of all child processes
Copy file name to clipboardExpand all lines: MC/doc/WorkflowRunner.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,11 +63,12 @@ still in development. Currently, it follows the following scheme:
63
63
"needs": [ "task1" ],
64
64
"resources": {
65
65
"cpu": -1,
66
-
"mem": -1
66
+
"mem": -1,
67
67
},
68
68
"timeframe": 1,
69
69
"labels": [ "DIGI", "ITS" ],
70
-
"cwd": "tf1"
70
+
"cwd": "tf1",
71
+
"semaphore" : "sem1"
71
72
}]
72
73
"comments" : "A DPG MC workflow for production FOO"
73
74
}
@@ -83,6 +84,7 @@ Further keys in this format are:
83
84
|`cwd`| the workding directory where this is to be executed |
84
85
|`label`| a list labels, describing this stage. Can be used to execute workfow in stages (such as 'do all digitization', 'run everthing for ITS' |
85
86
|`env`| local environment variables needed by the task |
87
+
|`semaphore`| (optional) Tasks are synchronized by a semaphore of that name. This can be used to exclude parallel execution of tasks (using the same semaphore name). |
86
88
87
89
While a workflow may be written by hand, it's more pratical to have it programmatically generated by sripts, that is sensitive to configuration and options. A current example following the PWGHF embedding exercise can be found here [create_embedding_workflow](https://github.com/AliceO2Group/O2DPG/blob/master/MC/run/PWGHF/create_embedding_workflow.py)
0 commit comments