@@ -434,16 +434,6 @@ void TaskRunner::startOfActivity()
434434 mCollector ->setRunNumber (mActivity .mId );
435435 mTask ->startOfActivity (mActivity );
436436 mObjectsManager ->updateServiceDiscovery ();
437-
438- // register ourselves to the BK
439- if (gSystem ->Getenv (" O2_QC_REGISTER_IN_BK" )) { // until we are sure it works, we have to turn it on
440- ILOG (Debug, Devel) << " Registering taskRunner to BookKeeping" << ENDM ;
441- try {
442- Bookkeeping::getInstance ().registerProcess (mActivity .mId , mTaskConfig .taskName , mTaskConfig .detectorName , bookkeeping::DPL_PROCESS_TYPE_QC_TASK , " " );
443- } catch (std::runtime_error& error) {
444- ILOG (Warning, Devel) << " Failed registration to the BookKeeping: " << error.what () << ENDM ;
445- }
446- }
447437}
448438
449439void TaskRunner::endOfActivity ()
@@ -483,6 +473,16 @@ void TaskRunner::finishCycle(DataAllocator& outputs)
483473 << " (" << mTimekeeper ->getTimerangeIdRange ().getMin () << " , " << mTimekeeper ->getTimerangeIdRange ().getMax () << " )" << ENDM ;
484474 mTask ->endOfCycle ();
485475
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+ } catch (std::runtime_error& error) {
482+ ILOG (Warning, Devel) << " Failed registration to the BookKeeping: " << error.what () << ENDM ;
483+ }
484+ }
485+
486486 // this stays until we move to using mTimekeeper.
487487 auto nowMs = getCurrentTimestamp ();
488488 mObjectsManager ->setValidity (mTimekeeper ->getValidity ());
0 commit comments