From 01ddbc35c823cdee2cbd1539cb487490d9b17d35 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 8 Apr 2025 09:06:08 +0200 Subject: [PATCH 1/2] DPL: fix setting of run number This is actually a workaround. The real issue is that timer at the moment are completely outside of the data streaming and therefore do not have access to the DataTakingService, where the proper calculation for the run number happens and it's cached. OK for now. In the future we should make sure that the LifetimeHelpers::enumerate gets a "Streaming" context, not the global one. --- Framework/Core/src/LifetimeHelpers.cxx | 2 +- Framework/Core/test/test_SimpleTimer.cxx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Framework/Core/src/LifetimeHelpers.cxx b/Framework/Core/src/LifetimeHelpers.cxx index 4621738ec154e..21aa29c1f10e9 100644 --- a/Framework/Core/src/LifetimeHelpers.cxx +++ b/Framework/Core/src/LifetimeHelpers.cxx @@ -423,7 +423,7 @@ ExpirationHandler::Handler LifetimeHelpers::enumerate(ConcreteDataMatcher const& dh.payloadSerializationMethod = gSerializationMethodNone; dh.tfCounter = timestamp; try { - dh.runNumber = atoi(services.get().runNumber.c_str()); + dh.runNumber = strtoull(services.get().device()->fConfig->GetProperty("runNumber", "0").c_str(), nullptr, 10); } catch (...) { dh.runNumber = 0; } diff --git a/Framework/Core/test/test_SimpleTimer.cxx b/Framework/Core/test/test_SimpleTimer.cxx index df935eb6eb2a0..83165ce4c4fd5 100644 --- a/Framework/Core/test/test_SimpleTimer.cxx +++ b/Framework/Core/test/test_SimpleTimer.cxx @@ -38,7 +38,11 @@ std::vector defineDataProcessing(ConfigContext const&) InputSpec{"atimer", "TST", "TIMER", 0, Lifetime::Timer}}, {}, AlgorithmSpec{ - adaptStateless([](ControlService& control) { + adaptStateless([](ControlService& control, InputRecord& inputs) { + DataRef ref = inputs.get("atimer"); + assert(header); + auto* header = o2::header::get(ref.header); + LOG(info) << "Run number: " << header->runNumber; // This is invoked autonomously by the timer. control.readyToQuit(QuitRequest::Me); })}}, From cab3b2351507efd6da31bb61826edb933c11690d Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 8 Apr 2025 17:17:20 +0200 Subject: [PATCH 2/2] Update test_SimpleTimer.cxx --- Framework/Core/test/test_SimpleTimer.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/Framework/Core/test/test_SimpleTimer.cxx b/Framework/Core/test/test_SimpleTimer.cxx index 83165ce4c4fd5..b2b5a4558f961 100644 --- a/Framework/Core/test/test_SimpleTimer.cxx +++ b/Framework/Core/test/test_SimpleTimer.cxx @@ -40,7 +40,6 @@ std::vector defineDataProcessing(ConfigContext const&) AlgorithmSpec{ adaptStateless([](ControlService& control, InputRecord& inputs) { DataRef ref = inputs.get("atimer"); - assert(header); auto* header = o2::header::get(ref.header); LOG(info) << "Run number: " << header->runNumber; // This is invoked autonomously by the timer.