Skip to content

Commit 6409c6a

Browse files
authored
DPL CCDB fetcher was ignorint condition-timestamp option (#16001)
1 parent 1dc8fd9 commit 6409c6a

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎Framework/CCDBSupport/src/CCDBHelpers.cxx‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB()
404404
return adaptStateful([](CallbackService& callbacks, ConfigParamRegistry const& options, DeviceSpec const& spec) {
405405
std::shared_ptr<CCDBFetcherHelper> helper = std::make_shared<CCDBFetcherHelper>();
406406
initialiseHelper(*helper, options, spec.outputs);
407+
auto forcedTimestamp = options.get<int64_t>("condition-timestamp");
407408
/// Add a callback on stop which dumps the statistics for the caching per
408409
/// path
409410
callbacks.set<CallbackService::Id::Stop>([helper]() {
@@ -413,7 +414,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB()
413414
}
414415
});
415416

416-
return adaptStateless([helper](DataTakingContext& dtc, DataAllocator& allocator, TimingInfo& timingInfo, DataProcessingStats& stats) {
417+
return adaptStateless([helper, forcedTimestamp](DataTakingContext& dtc, DataAllocator& allocator, TimingInfo& timingInfo, DataProcessingStats& stats) {
417418
auto sid = _o2_signpost_id_t{(int64_t)timingInfo.timeslice};
418419
O2_SIGNPOST_START(ccdb, sid, "fetchFromCCDB", "Fetching CCDB objects for timeslice %" PRIu64, (uint64_t)timingInfo.timeslice);
419420
static Long64_t orbitResetTime = -1;
@@ -423,6 +424,7 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB()
423424
timingInfo.creation = lastTimeUsed;
424425
}
425426
lastTimeUsed = timingInfo.creation;
427+
auto lookupTimestamp = forcedTimestamp > 0 ? forcedTimestamp : static_cast<int64_t>(timingInfo.creation);
426428
// Fetch the CCDB object for the CTP
427429
{
428430
const std::string path = "CTP/Calib/OrbitReset";
@@ -445,9 +447,9 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB()
445447
const auto& api = helper->getAPI(path);
446448
if (checkValidity && (!api.isSnapshotMode() || etag.empty())) { // in the snapshot mode the object needs to be fetched only once
447449
helper->lastCheckedTFCounterOrbReset = counter;
448-
api.loadFileToMemory(v, path, metadata, timingInfo.creation, &headers, etag, helper->createdNotAfter, helper->createdNotBefore);
450+
api.loadFileToMemory(v, path, metadata, lookupTimestamp, &headers, etag, helper->createdNotAfter, helper->createdNotBefore);
449451
if ((headers.count("Error") != 0) || (etag.empty() && v.empty())) {
450-
LOGP(fatal, "Unable to find CCDB object {}/{}", path, timingInfo.creation);
452+
LOGP(fatal, "Unable to find CCDB object {}/{}", path, lookupTimestamp);
451453
// FIXME: I should send a dummy message.
452454
return;
453455
}
@@ -504,6 +506,9 @@ AlgorithmSpec CCDBHelpers::fetchFromCCDB()
504506
}
505507
timestamp = timingInfo.creation;
506508
}
509+
if (forcedTimestamp > 0) {
510+
timestamp = forcedTimestamp;
511+
}
507512
// Fetch the rest of the objects.
508513
O2_SIGNPOST_EVENT_EMIT(ccdb, sid, "fetchFromCCDB", "Fetching objects. Run %{public}s. OrbitResetTime %lld. Creation %lld. Timestamp %lld. firstTForbit %" PRIu32,
509514
dtc.runNumber.data(), orbitResetTime, timingInfo.creation, timestamp, timingInfo.firstTForbit);

‎Framework/Core/src/WorkflowHelpers.cxx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ void WorkflowHelpers::injectServiceDevices(WorkflowSpec& workflow, ConfigContext
161161
.name = "internal-dpl-ccdb-backend",
162162
.outputs = {},
163163
.options = {{"condition-backend", VariantType::String, defaultConditionBackend(), {"URL for CCDB"}},
164+
{"condition-timestamp", VariantType::Int64, 0ll, {"Force timestamp for CCDB lookup"}},
164165
{"condition-not-before", VariantType::Int64, 0ll, {"do not fetch from CCDB objects created before provide timestamp"}},
165166
{"condition-not-after", VariantType::Int64, 3385078236000ll, {"do not fetch from CCDB objects created after the timestamp"}},
166167
{"condition-remap", VariantType::String, "", {"remap condition path in CCDB based on the provided string."}},

0 commit comments

Comments
 (0)