Adding customizable hook to be executed on workflow termination - #2196
Conversation
This defines a function callback `OnWorkflowTerminationHook` with signature `void (const char*)` and allows to set the hook using the `customize` mechanism of DPL workflows. The callback hook is invoked just before processes terminate. The hook is invoked for all childs and the main driver, the id string is passed as parameter to customize the callback action. For the main driver, the nullptr is passed.
davidrohr
left a comment
There was a problem hiding this comment.
Looks like a useful feature for me, just have one comment below:
| } | ||
|
|
||
| char* idstring = nullptr; | ||
| for (int argi = 0; argi < argc; argi++) { |
There was a problem hiding this comment.
Is --id a new option needed for this hook? I think not?
In that case, perhaps the id parameter is already available from somewhere else, and does not need to be parsed from the cmdline again?
There was a problem hiding this comment.
The --id parameter is added by the main driver so that every child process knows it's role in the workflow. So it is there already. The parsing of all the options is done in doMain in the cxx file. The customization happens in the header file because of some template trick, so one would need to pass the function as another parameter to do main.
Using this id parameter allows to customize the hook depending on the position of a process in the workflow.
I decided not to do this and implement some simple parsing. But well, that can be changed.
|
LGTM. |
|
@davidrohr , cuda CI fails in two unit tests Du you also think its unrelated? I can find anything suspicious in the log |
|
Hi @matthiasrichter : I have no idea what is the problem, but I have also seen cuda CI fail random tests in the last days. I would assume something is wrong with that CI in general. In any case, I do not think it is related to this PR. |
This defines a function callback `OnWorkflowTerminationHook` with signature `void (const char*)` and allows to set the hook using the `customize` mechanism of DPL workflows. The callback hook is invoked just before processes terminate. The hook is invoked for all childs and the main driver, the id string is passed as parameter to customize the callback action. For the main driver, the nullptr is passed.
…eO2Group#2196) This defines a function callback `OnWorkflowTerminationHook` with signature `void (const char*)` and allows to set the hook using the `customize` mechanism of DPL workflows. The callback hook is invoked just before processes terminate. The hook is invoked for all childs and the main driver, the id string is passed as parameter to customize the callback action. For the main driver, the nullptr is passed.
…eO2Group#2196) This defines a function callback `OnWorkflowTerminationHook` with signature `void (const char*)` and allows to set the hook using the `customize` mechanism of DPL workflows. The callback hook is invoked just before processes terminate. The hook is invoked for all childs and the main driver, the id string is passed as parameter to customize the callback action. For the main driver, the nullptr is passed.
…up#2196) * [PWGLF] LightNucleiSpectra - Add DCA custom cut * [PWGLF] LightNucleiTask - Improve PID cuts * [PWGLF] LightNucleiTask - Add flags to optimize subwagons
This defines a function callback
OnWorkflowTerminationHookwith signaturevoid (const char*)and allows to set the hook using thecustomizemechanismof DPL workflows. The callback hook is invoked just before processes terminate.
The hook is invoked for all childs and the main driver, the id string is passed
as parameter to customize the callback action. For the main driver, the nullptr
is passed.
This is a simple mechanism to allow for deterministic actions at the end of the workflow or parts of it.
An example use case is [O2-778] https://alice.its.cern.ch/jira/browse/O2-778