Skip to content

Commit

Permalink
Add configurable option to make invalid timestamps fatal
Browse files Browse the repository at this point in the history
The changes introduce a new configurable option `fatalOnInvalidTimestamp` that allows the user to control the behavior when the timestamp information is not available in the CCDB. When set to `true`, the task will generate a fatal error, otherwise it will just log a warning. This gives the user more control over how to handle invalid timestamps.

Additionally, the commit clarifies the meaning of the SOR/EOR timestamps, indicating that they can represent the start/end of the run, or the start/end of the sub-timeframe, depending on the run type.
  • Loading branch information
mpuccio committed Sep 9, 2024
1 parent a59107e commit c8e3a57
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Common/TableProducer/timestamp.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ struct TimestampTask {
Produces<aod::Timestamps> timestampTable; /// Table with SOR timestamps produced by the task
Service<o2::ccdb::BasicCCDBManager> ccdb; /// CCDB manager to access orbit-reset timestamp
o2::ccdb::CcdbApi ccdb_api; /// API to access CCDB headers
Configurable<bool> fatalOnInvalidTimestamp{"fatalOnInvalidTimestamp", false, "Generate fatal error for invalid timestamps"};
std::map<int, int64_t> mapRunToOrbitReset; /// Cache of orbit reset timestamps
std::map<int, std::pair<int64_t, int64_t>> mapRunToRunDuration; /// Cache of run duration timestamps
int lastRunNumber = 0; /// Last run number processed
Expand Down Expand Up @@ -81,8 +82,8 @@ struct TimestampTask {
} else { // The run was not requested before: need to acccess CCDB!
LOGF(debug, "Getting start-of-run and end-of-run timestamps from CCDB");
runDuration = ccdb->getRunDuration(runNumber, true); /// fatalise if timestamps are not found
int64_t sorTimestamp = runDuration.first; // timestamp of the SOR in ms
int64_t eorTimestamp = runDuration.second; // timestamp of the EOR in ms
int64_t sorTimestamp = runDuration.first; // timestamp of the SOR/SOX/STF in ms
int64_t eorTimestamp = runDuration.second; // timestamp of the EOR/EOX/ETF in ms

const bool isUnanchoredRun3MC = runNumber >= 300000 && runNumber < 500000;
if (isRun2MC.value == 1 || isUnanchoredRun3MC) {
Expand Down

0 comments on commit c8e3a57

Please sign in to comment.