From 1ffb291d2cfc1127ee6112c2ee301be5e33b4fb0 Mon Sep 17 00:00:00 2001 From: shahoian Date: Sat, 24 Oct 2026 01:20:56 +0200 Subject: [PATCH] DPL CCDB fetcher was ignorint condition-timestamp option --- Framework/CCDBSupport/src/CCDBHelpers.cxx | 11 ++++++++--- Framework/Core/src/WorkflowHelpers.cxx | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Framework/CCDBSupport/src/CCDBHelpers.cxx b/Framework/CCDBSupport/src/CCDBHelpers.cxx index 8ba9216f888a3..47ba6f00953cf 100644 --- a/Framework/CCDBSupport/src/CCDBHelpers.cxx +++ b/Framework/CCDBSupport/src/CCDBHelpers.cxx @@ -404,6 +404,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() return adaptStateful([](CallbackService& callbacks, ConfigParamRegistry const& options, DeviceSpec const& spec) { std::shared_ptr helper = std::make_shared(); initialiseHelper(*helper, options, spec.outputs); + auto forcedTimestamp = options.get("condition-timestamp"); /// Add a callback on stop which dumps the statistics for the caching per /// path callbacks.set([helper]() { @@ -413,7 +414,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() } }); - return adaptStateless([helper](DataTakingContext& dtc, DataAllocator& allocator, TimingInfo& timingInfo, DataProcessingStats& stats) { + return adaptStateless([helper, forcedTimestamp](DataTakingContext& dtc, DataAllocator& allocator, TimingInfo& timingInfo, DataProcessingStats& stats) { auto sid = _o2_signpost_id_t{(int64_t)timingInfo.timeslice}; O2_SIGNPOST_START(ccdb, sid, "fetchFromCCDB", "Fetching CCDB objects for timeslice %" PRIu64, (uint64_t)timingInfo.timeslice); static Long64_t orbitResetTime = -1; @@ -423,6 +424,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() timingInfo.creation = lastTimeUsed; } lastTimeUsed = timingInfo.creation; + auto lookupTimestamp = forcedTimestamp > 0 ? forcedTimestamp : static_cast(timingInfo.creation); // Fetch the CCDB object for the CTP { const std::string path = "CTP/Calib/OrbitReset"; @@ -445,9 +447,9 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() const auto& api = helper->getAPI(path); if (checkValidity && (!api.isSnapshotMode() || etag.empty())) { // in the snapshot mode the object needs to be fetched only once helper->lastCheckedTFCounterOrbReset = counter; - api.loadFileToMemory(v, path, metadata, timingInfo.creation, &headers, etag, helper->createdNotAfter, helper->createdNotBefore); + api.loadFileToMemory(v, path, metadata, lookupTimestamp, &headers, etag, helper->createdNotAfter, helper->createdNotBefore); if ((headers.count("Error") != 0) || (etag.empty() && v.empty())) { - LOGP(fatal, "Unable to find CCDB object {}/{}", path, timingInfo.creation); + LOGP(fatal, "Unable to find CCDB object {}/{}", path, lookupTimestamp); // FIXME: I should send a dummy message. return; } @@ -504,6 +506,9 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB() } timestamp = timingInfo.creation; } + if (forcedTimestamp > 0) { + timestamp = forcedTimestamp; + } // Fetch the rest of the objects. O2_SIGNPOST_EVENT_EMIT(ccdb, sid, "fetchFromCCDB", "Fetching objects. Run %{public}s. OrbitResetTime %lld. Creation %lld. Timestamp %lld. firstTForbit %" PRIu32, dtc.runNumber.data(), orbitResetTime, timingInfo.creation, timestamp, timingInfo.firstTForbit); diff --git a/Framework/Core/src/WorkflowHelpers.cxx b/Framework/Core/src/WorkflowHelpers.cxx index 188b6653c6a43..86e1e8c09dee5 100644 --- a/Framework/Core/src/WorkflowHelpers.cxx +++ b/Framework/Core/src/WorkflowHelpers.cxx @@ -161,6 +161,7 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext .name = "internal-dpl-ccdb-backend", .outputs = {}, .options = {{"condition-backend", VariantType::String, defaultConditionBackend(), {"URL for CCDB"}}, + {"condition-timestamp", VariantType::Int64, 0ll, {"Force timestamp for CCDB lookup"}}, {"condition-not-before", VariantType::Int64, 0ll, {"do not fetch from CCDB objects created before provide timestamp"}}, {"condition-not-after", VariantType::Int64, 3385078236000ll, {"do not fetch from CCDB objects created after the timestamp"}}, {"condition-remap", VariantType::String, "", {"remap condition path in CCDB based on the provided string."}},