diff --git a/Framework/Core/include/Framework/runDataProcessing.h b/Framework/Core/include/Framework/runDataProcessing.h index f52ba08aa3f53..07083314af12e 100644 --- a/Framework/Core/include/Framework/runDataProcessing.h +++ b/Framework/Core/include/Framework/runDataProcessing.h @@ -87,11 +87,6 @@ void defaultConfiguration(std::vector& services) /// Workflow options which are required by DPL in order to work. std::vector requiredWorkflowOptions(); -void defaultConfiguration(o2::framework::OnWorkflowTerminationHook& hook) -{ - hook = [](const char*) {}; -} - template concept WithUserOverride = requires(T& something) { customize(something); }; @@ -154,6 +149,22 @@ std::vector injectCustomizations() return policies; } +template + requires requires(T& hook) { customize(hook); } +void callWorkflowTermination(T& hook, char const* idstring) +{ + customize(hook); + hook(idstring); + doDefaultWorkflowTerminationHook(); +} + +// Do not call the user hook if it's not there. +template +void callWorkflowTermination(T&, char const* idstring) +{ + doDefaultWorkflowTerminationHook(); +} + void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow); o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, @@ -208,9 +219,7 @@ int main(int argc, char** argv) char* idstring = getIdString(argc, argv); o2::framework::OnWorkflowTerminationHook onWorkflowTerminationHook; - UserCustomizationsHelper::userDefinedCustomization(onWorkflowTerminationHook); - onWorkflowTerminationHook(idstring); - doDefaultWorkflowTerminationHook(); + callWorkflowTermination(onWorkflowTerminationHook, idstring); return result; }