@@ -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+
465488void 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