From e275a6b4f84772ccd9d716dd9230045d82c9c416 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 1 Dec 2026 00:58:41 +0100 Subject: [PATCH] Construct ServiceRegistryRef explicitly from ServiceRegistry O2 is making the ServiceRegistryRef constructor from ServiceRegistry& explicit, so the implicit conversions in the post-processing runner, its executables and the tests no longer compile. Construct the references explicitly, with the device salt which the implicit conversion used. This builds against both the current and the new O2. --- Framework/src/PostProcessingRunner.cxx | 6 +++--- Framework/src/runPostProcessing.cxx | 4 ++-- Framework/src/runPostProcessingOCC.cxx | 4 ++-- Framework/test/testAggregatorRunner.cxx | 2 +- Framework/test/testPostProcessingInterface.cxx | 6 +++--- Framework/test/testTaskInterface.cxx | 2 +- Framework/test/testTaskRunner.cxx | 2 +- Framework/test/testTrendingTask.cxx | 14 +++++++------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Framework/src/PostProcessingRunner.cxx b/Framework/src/PostProcessingRunner.cxx index 294ef12075..feb59a6f74 100644 --- a/Framework/src/PostProcessingRunner.cxx +++ b/Framework/src/PostProcessingRunner.cxx @@ -281,7 +281,7 @@ void PostProcessingRunner::doInitialize(const Trigger& trigger) { ILOG(Info, Support) << "Initializing the user task due to trigger '" << trigger << "'" << ENDM; - mTask->initialize(trigger, mServices); + mTask->initialize(trigger, framework::ServiceRegistryRef{ mServices, framework::ServiceRegistry::globalDeviceSalt() }); updateValidity(trigger); mTaskState = TaskState::Running; @@ -296,7 +296,7 @@ void PostProcessingRunner::doInitialize(const Trigger& trigger) void PostProcessingRunner::doUpdate(const Trigger& trigger) { ILOG(Info, Support) << "Updating the user task due to trigger '" << trigger << "'" << ENDM; - mTask->update(trigger, mServices); + mTask->update(trigger, framework::ServiceRegistryRef{ mServices, framework::ServiceRegistry::globalDeviceSalt() }); updateValidity(trigger); if (mActivity.mValidity.isValid()) { @@ -314,7 +314,7 @@ void PostProcessingRunner::doFinalize(const Trigger& trigger) return; } ILOG(Info, Support) << "Finalizing the user task due to trigger '" << trigger << "'" << ENDM; - mTask->finalize(trigger, mServices); + mTask->finalize(trigger, framework::ServiceRegistryRef{ mServices, framework::ServiceRegistry::globalDeviceSalt() }); updateValidity(trigger); if (mActivity.mValidity.isValid()) { diff --git a/Framework/src/runPostProcessing.cxx b/Framework/src/runPostProcessing.cxx index 05521ae147..69ce89c185 100644 --- a/Framework/src/runPostProcessing.cxx +++ b/Framework/src/runPostProcessing.cxx @@ -85,7 +85,7 @@ int main(int argc, const char* argv[]) runner.runOverTimestamps(vm["timestamps"].as>()); } else { // running the PP task with an event loop - runner.start({ registry }); + runner.start(o2::framework::ServiceRegistryRef{ registry, ServiceRegistry::globalDeviceSalt() }); Timer timer; timer.reset(periodUs); @@ -96,7 +96,7 @@ int main(int argc, const char* argv[]) usleep(1000000.0 * timer.getRemainingTime()); } } - runner.stop({ registry }); + runner.stop(o2::framework::ServiceRegistryRef{ registry, ServiceRegistry::globalDeviceSalt() }); return 0; } catch (const bpo::error& ex) { ILOG(Error, Ops) << "Exception caught: " << ex.what() << ENDM; diff --git a/Framework/src/runPostProcessingOCC.cxx b/Framework/src/runPostProcessingOCC.cxx index 44b520ab75..d6d77b5103 100644 --- a/Framework/src/runPostProcessingOCC.cxx +++ b/Framework/src/runPostProcessingOCC.cxx @@ -97,7 +97,7 @@ class PostProcessingOCCStateMachine : public RuntimeControlledObject bool success = true; try { o2::framework::ServiceRegistry registry; - mRunner->start(registry); + mRunner->start(o2::framework::ServiceRegistryRef{ registry, o2::framework::ServiceRegistry::globalDeviceSalt() }); } catch (const std::exception& ex) { ILOG(Error, Support) << "Exception caught: " << ex.what() << ENDM; success = false; @@ -119,7 +119,7 @@ class PostProcessingOCCStateMachine : public RuntimeControlledObject bool success = true; try { o2::framework::ServiceRegistry registry; - mRunner->stop(registry); + mRunner->stop(o2::framework::ServiceRegistryRef{ registry, o2::framework::ServiceRegistry::globalDeviceSalt() }); } catch (const std::exception& ex) { ILOG(Error, Support) << "Exception caught: " << ex.what() << ENDM; success = false; diff --git a/Framework/test/testAggregatorRunner.cxx b/Framework/test/testAggregatorRunner.cxx index 91a5a62948..629eb9f89f 100644 --- a/Framework/test/testAggregatorRunner.cxx +++ b/Framework/test/testAggregatorRunner.cxx @@ -63,7 +63,7 @@ TEST_CASE("test_aggregator_runner") std::unique_ptr store = make_unique(std::move(options), std::move(retr)); ConfigParamRegistry cfReg(std::move(store)); ServiceRegistry sReg; - InitContext initContext{ cfReg, sReg }; + InitContext initContext{ cfReg, ServiceRegistryRef{ sReg, ServiceRegistry::globalDeviceSalt() } }; aggregatorRunner.init(initContext); CHECK(aggregatorRunner.getDeviceName() == "qc-aggregator"); diff --git a/Framework/test/testPostProcessingInterface.cxx b/Framework/test/testPostProcessingInterface.cxx index bd88becf73..aaef54c31e 100644 --- a/Framework/test/testPostProcessingInterface.cxx +++ b/Framework/test/testPostProcessingInterface.cxx @@ -79,10 +79,10 @@ TEST_CASE("PostProcessingInterface_test_factory") o2::framework::ServiceRegistry services; - task.initialize({ TriggerType::No }, services); + task.initialize({ TriggerType::No }, o2::framework::ServiceRegistryRef{ services, o2::framework::ServiceRegistry::globalDeviceSalt() }); CHECK(task.test == 2); - task.update({ TriggerType::No }, services); + task.update({ TriggerType::No }, o2::framework::ServiceRegistryRef{ services, o2::framework::ServiceRegistry::globalDeviceSalt() }); CHECK(task.test == 3); - task.finalize({ TriggerType::No }, services); + task.finalize({ TriggerType::No }, o2::framework::ServiceRegistryRef{ services, o2::framework::ServiceRegistry::globalDeviceSalt() }); CHECK(task.test == 4); } \ No newline at end of file diff --git a/Framework/test/testTaskInterface.cxx b/Framework/test/testTaskInterface.cxx index ce8fc4713c..d3497b81d9 100644 --- a/Framework/test/testTaskInterface.cxx +++ b/Framework/test/testTaskInterface.cxx @@ -150,7 +150,7 @@ TEST_CASE("test_invoke_all_TaskRunnerConfig_methods") auto options = createDummyRegistry(); ServiceRegistry services; - InitContext ctx(options, services); + InitContext ctx(options, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() }); testTask.initialize(ctx); CHECK(testTask.test == 1); diff --git a/Framework/test/testTaskRunner.cxx b/Framework/test/testTaskRunner.cxx index af0e8d4752..82e8bb8e3f 100644 --- a/Framework/test/testTaskRunner.cxx +++ b/Framework/test/testTaskRunner.cxx @@ -112,7 +112,7 @@ TEST_CASE("test_task_runner") std::unique_ptr store = make_unique(std::move(options), std::move(retr)); ConfigParamRegistry cfReg(std::move(store)); ServiceRegistry sReg; - InitContext initContext{ cfReg, sReg }; + InitContext initContext{ cfReg, ServiceRegistryRef{ sReg, ServiceRegistry::globalDeviceSalt() } }; qcTask.init(initContext); } diff --git a/Framework/test/testTrendingTask.cxx b/Framework/test/testTrendingTask.cxx index 37bf172b0c..8b3992e8a3 100644 --- a/Framework/test/testTrendingTask.cxx +++ b/Framework/test/testTrendingTask.cxx @@ -210,7 +210,7 @@ TEST_CASE("test_trending_task", "[ccdb]") } // test initialize() - REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, services)); + REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() })); REQUIRE(objectManager->getNumberPublishedObjects() == 1); auto treeMO = objectManager->getMonitorObject(trendingTaskName); REQUIRE(treeMO != nullptr); @@ -219,9 +219,9 @@ TEST_CASE("test_trending_task", "[ccdb]") REQUIRE(tree->GetEntries() == 0); // test update() - task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, services); + task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() }); objectManager->stopPublishing(PublicationPolicy::Once); - task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, services); + task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() }); REQUIRE(objectManager->getNumberPublishedObjects() == 1); REQUIRE(tree->GetEntries() == 0); } @@ -277,7 +277,7 @@ TEST_CASE("test_trending_task", "[ccdb]") REQUIRE_NOTHROW(task.configure(config)); // test initialize() - REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, services)); + REQUIRE_NOTHROW(task.initialize({ TriggerType::UserOrControl, true, { 0, "NONE", "", "", "qc" }, 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() })); REQUIRE(objectManager->getNumberPublishedObjects() == 1); auto treeMO = objectManager->getMonitorObject(trendingTaskName); REQUIRE(treeMO != nullptr); @@ -286,9 +286,9 @@ TEST_CASE("test_trending_task", "[ccdb]") REQUIRE(tree->GetEntries() == 0); // test update() - task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, services); + task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 2, 100000 } }, 100000 - 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() }); objectManager->stopPublishing(PublicationPolicy::Once); - task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, services); + task.update({ TriggerType::NewObject, false, { 0, "NONE", "", "", "qc", { 100000, 200000 } }, 200000 - 1 }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() }); REQUIRE(objectManager->getNumberPublishedObjects() == 3); REQUIRE(tree->GetEntries() == 2); auto varexp = "testHistoTrending.mean:testHistoTrending.entries:" + checkName + ".level"; @@ -319,7 +319,7 @@ TEST_CASE("test_trending_task", "[ccdb]") objectManager->stopPublishing(PublicationPolicy::Once); // test finalize() - REQUIRE_NOTHROW(task.finalize({ TriggerType::UserOrControl, true }, services)); + REQUIRE_NOTHROW(task.finalize({ TriggerType::UserOrControl, true }, ServiceRegistryRef{ services, ServiceRegistry::globalDeviceSalt() })); REQUIRE(objectManager->getNumberPublishedObjects() == 3); REQUIRE(tree->GetEntries() == 2); objectManager->stopPublishing(PublicationPolicy::Once);