@@ -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 );
0 commit comments