diff --git a/Framework/Core/include/Framework/runDataProcessing.h b/Framework/Core/include/Framework/runDataProcessing.h index 6c1897bc8c1f3..f52ba08aa3f53 100644 --- a/Framework/Core/include/Framework/runDataProcessing.h +++ b/Framework/Core/include/Framework/runDataProcessing.h @@ -12,6 +12,7 @@ #define FRAMEWORK_RUN_DATA_PROCESSING_H #include +#include "Framework/ConfigParamSpec.h" #include "Framework/ChannelConfigurationPolicy.h" #include "Framework/CallbacksPolicy.h" #include "Framework/CompletionPolicy.h" @@ -22,17 +23,13 @@ #include "Framework/SendingPolicy.h" #include "Framework/WorkflowSpec.h" #include "Framework/ConfigContext.h" -#include "Framework/BoostOptionsRetriever.h" #include "Framework/CustomWorkflowTerminationHook.h" #include "Framework/CommonServices.h" #include "Framework/WorkflowCustomizationHelpers.h" -#include "Framework/ResourcePolicyHelpers.h" #include "Framework/Logger.h" #include "Framework/CheckTypes.h" #include "Framework/StructToTuple.h" -#include "Framework/ConfigParamDiscovery.h" #include "ResourcePolicy.h" -#include "ServiceRegistryRef.h" #include namespace o2::framework @@ -120,7 +117,9 @@ struct UserCustomizationsHelper { namespace o2::framework { class ConfigContext; -} +class ConfigParamRegistry; +class ConfigParamSpec; +} // namespace o2::framework /// Helper used to customize a workflow pipelining options void overridePipeline(o2::framework::ConfigContext& ctx, std::vector& workflow); @@ -155,10 +154,18 @@ std::vector injectCustomizations() return policies; } +void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow); + +o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, + o2::framework::ServiceRegistry& configRegistry, + std::vector& workflowOptions, + std::vector& extraOptions, int argc, char** argv); + +std::unique_ptr createRegistry(); + int mainNoCatch(int argc, char** argv) { using namespace o2::framework; - using namespace boost::program_options; std::vector workflowOptions; UserCustomizationsHelper::userDefinedCustomization(workflowOptions); @@ -171,24 +178,13 @@ int mainNoCatch(int argc, char** argv) std::vector callbacksPolicies = injectCustomizations(); std::vector sendingPolicies = injectCustomizations(); - std::vector> retrievers; - std::unique_ptr retriever{new BoostOptionsRetriever(true, argc, argv)}; - retrievers.emplace_back(std::move(retriever)); - auto workflowOptionsStore = std::make_unique(workflowOptions, std::move(retrievers)); - workflowOptionsStore->preload(); - workflowOptionsStore->activate(); - ConfigParamRegistry workflowOptionsRegistry(std::move(workflowOptionsStore)); - auto extraOptions = o2::framework::ConfigParamDiscovery::discover(workflowOptionsRegistry, argc, argv); - for (auto& extra : extraOptions) { - workflowOptions.push_back(extra); - } + std::unique_ptr configRegistry = createRegistry(); + std::vector extraOptions; + std::unique_ptr workflowOptionsRegistry{nullptr}; + auto configContext = createConfigContext(workflowOptionsRegistry, *configRegistry, workflowOptions, extraOptions, argc, argv); - ServiceRegistry configRegistry; - ConfigContext configContext(workflowOptionsRegistry, ServiceRegistryRef{configRegistry}, argc, argv); o2::framework::WorkflowSpec specs = defineDataProcessing(configContext); - overrideCloning(configContext, specs); - overridePipeline(configContext, specs); - overrideLabels(configContext, specs); + overrideAll(configContext, specs); for (auto& spec : specs) { UserCustomizationsHelper::userDefinedCustomization(spec.requiredServices); } @@ -207,7 +203,6 @@ char* getIdString(int argc, char** argv); int main(int argc, char** argv) { using namespace o2::framework; - using namespace boost::program_options; int result = callMain(argc, argv, mainNoCatch); diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index 03b013d266316..e5263247e641b 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -8,6 +8,7 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include #define BOOST_BIND_GLOBAL_PLACEHOLDERS #include #include "Framework/BoostOptionsRetriever.h" @@ -69,6 +70,7 @@ #include "HTTPParser.h" #include "DPLWebSocket.h" #include "ArrowSupport.h" +#include "Framework/ConfigParamDiscovery.h" #include "ComputingResourceHelpers.h" #include "DataProcessingStatus.h" @@ -2806,6 +2808,38 @@ void enableSignposts(std::string const& signpostsToEnable) } } +void overrideAll(o2::framework::ConfigContext& ctx, std::vector& workflow) +{ + overrideCloning(ctx, workflow); + overridePipeline(ctx, workflow); + overrideLabels(ctx, workflow); +} + +o2::framework::ConfigContext createConfigContext(std::unique_ptr& workflowOptionsRegistry, + o2::framework::ServiceRegistry& configRegistry, + std::vector& workflowOptions, + std::vector& extraOptions, int argc, char** argv) +{ + std::vector> retrievers; + std::unique_ptr retriever{new o2::framework::BoostOptionsRetriever(true, argc, argv)}; + retrievers.emplace_back(std::move(retriever)); + auto workflowOptionsStore = std::make_unique(workflowOptions, std::move(retrievers)); + workflowOptionsStore->preload(); + workflowOptionsStore->activate(); + workflowOptionsRegistry = std::make_unique(std::move(workflowOptionsStore)); + extraOptions = o2::framework::ConfigParamDiscovery::discover(*workflowOptionsRegistry, argc, argv); + for (auto& extra : extraOptions) { + workflowOptions.push_back(extra); + } + + return o2::framework::ConfigContext(*workflowOptionsRegistry, o2::framework::ServiceRegistryRef{configRegistry}, argc, argv); +} + +std::unique_ptr createRegistry() +{ + return std::make_unique(); +} + // This is a toy executor for the workflow spec // What it needs to do is: //