Skip to content

Commit 651d9e5

Browse files
committed
DPL: improve calling of the termination hook
1 parent 8722184 commit 651d9e5

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

Framework/Core/include/Framework/runDataProcessing.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ void defaultConfiguration(std::vector<o2::framework::ServiceSpec>& services)
8787
/// Workflow options which are required by DPL in order to work.
8888
std::vector<o2::framework::ConfigParamSpec> requiredWorkflowOptions();
8989

90-
void defaultConfiguration(o2::framework::OnWorkflowTerminationHook& hook)
91-
{
92-
hook = [](const char*) {};
93-
}
94-
9590
template <typename T>
9691
concept WithUserOverride = requires(T& something) { customize(something); };
9792

@@ -154,6 +149,22 @@ std::vector<T> injectCustomizations()
154149
return policies;
155150
}
156151

152+
template <typename T>
153+
requires requires(T& hook) { customize(hook); }
154+
void callWorkflowTermination(T& hook, char const* idstring)
155+
{
156+
customize(hook);
157+
hook(idstring);
158+
doDefaultWorkflowTerminationHook();
159+
}
160+
161+
// Do not call the user hook if it's not there.
162+
template <typename T>
163+
void callWorkflowTermination(T&, char const* idstring)
164+
{
165+
doDefaultWorkflowTerminationHook();
166+
}
167+
157168
void overrideAll(o2::framework::ConfigContext& ctx, std::vector<o2::framework::DataProcessorSpec>& workflow);
158169

159170
o2::framework::ConfigContext createConfigContext(std::unique_ptr<o2::framework::ConfigParamRegistry>& workflowOptionsRegistry,
@@ -208,9 +219,7 @@ int main(int argc, char** argv)
208219

209220
char* idstring = getIdString(argc, argv);
210221
o2::framework::OnWorkflowTerminationHook onWorkflowTerminationHook;
211-
UserCustomizationsHelper::userDefinedCustomization(onWorkflowTerminationHook);
212-
onWorkflowTerminationHook(idstring);
213-
doDefaultWorkflowTerminationHook();
222+
callWorkflowTermination(onWorkflowTerminationHook, idstring);
214223

215224
return result;
216225
}

0 commit comments

Comments
 (0)