Skip to content

Commit 59cb87b

Browse files
authored
More flags to benchmark QC and BK (#2050)
O2_QC_REGISTER_IN_BK --> register at end of cycle O2_QC_REGISTER_IN_BK_AT_START --> register at START O2_QC_REGISTER_IN_BK_X_TIMES --> register X times, requires O2_QC_REGISTER_IN_BK or O2_QC_REGISTER_IN_BK_AT_START
1 parent 72358b2 commit 59cb87b

2 files changed

Lines changed: 27 additions & 15 deletions

File tree

Framework/include/QualityControl/TaskRunner.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class TaskRunner : public framework::Task
143143
Activity mActivity;
144144

145145
void updateMonitoringStats(framework::ProcessingContext& pCtx);
146+
void registerToBookkeeping();
146147

147148
bool mCycleOn = false;
148149
bool mNoMoreCycles = false;

Framework/src/TaskRunner.cxx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ void TaskRunner::start(ServiceRegistryRef services)
338338
mNoMoreCycles = false;
339339
mCycleNumber = 0;
340340

341+
if (gSystem->Getenv("O2_QC_REGISTER_IN_BK_AT_START")) {
342+
// until we are sure it works, we have to turn it on
343+
registerToBookkeeping();
344+
}
345+
341346
try {
342347
startOfActivity();
343348
startCycle();
@@ -462,6 +467,24 @@ void TaskRunner::startCycle()
462467
mCycleOn = true;
463468
}
464469

470+
void TaskRunner::registerToBookkeeping()
471+
{
472+
// register ourselves to the BK at the first cycle
473+
ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM;
474+
try {
475+
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bookkeeping::DPL_PROCESS_TYPE_QC_TASK, "");
476+
if (gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES")) {
477+
ILOG(Debug, Devel) << "O2_QC_REGISTER_IN_BK_X_TIMES set to " << gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES") << ENDM;
478+
int iterations = std::stoi(gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES"));
479+
for (int i = 1; i < iterations; i++) { // start at 1 because we already did it once
480+
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bookkeeping::DPL_PROCESS_TYPE_QC_TASK, "");
481+
}
482+
}
483+
} catch (std::runtime_error& error) {
484+
ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM;
485+
}
486+
}
487+
465488
void TaskRunner::finishCycle(DataAllocator& outputs)
466489
{
467490
ILOG(Debug, Support) << "Finish cycle " << mCycleNumber << ENDM;
@@ -473,21 +496,9 @@ void TaskRunner::finishCycle(DataAllocator& outputs)
473496
<< "(" << mTimekeeper->getTimerangeIdRange().getMin() << ", " << mTimekeeper->getTimerangeIdRange().getMax() << ")" << ENDM;
474497
mTask->endOfCycle();
475498

476-
// register ourselves to the BK at the first cycle
477-
if (mCycleNumber == 0 && gSystem->Getenv("O2_QC_REGISTER_IN_BK")) { // until we are sure it works, we have to turn it on
478-
ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM;
479-
try {
480-
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bookkeeping::DPL_PROCESS_TYPE_QC_TASK, "");
481-
if (gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES")) {
482-
ILOG(Debug, Devel) << "O2_QC_REGISTER_IN_BK_X_TIMES set to " << gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES") << ENDM;
483-
int iterations = std::stoi(gSystem->Getenv("O2_QC_REGISTER_IN_BK_X_TIMES"));
484-
for (int i = 1; i < iterations; i++) { // start at 1 because we already did it once
485-
Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bookkeeping::DPL_PROCESS_TYPE_QC_TASK, "");
486-
}
487-
}
488-
} catch (std::runtime_error& error) {
489-
ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM;
490-
}
499+
if (mCycleNumber == 0 && gSystem->Getenv("O2_QC_REGISTER_IN_BK")) {
500+
// until we are sure it works, we have to turn it on
501+
registerToBookkeeping();
491502
}
492503

493504
// this stays until we move to using mTimekeeper.

0 commit comments

Comments
 (0)