From 18b34be4be6d9433dd66c1e422432cc8ba08c668 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 12 Nov 2025 16:07:45 +0100 Subject: [PATCH 1/4] Add the env var to disable the publication from Tasks to BK --- Framework/src/TaskRunner.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 65979e8e28..613763c8dd 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -434,12 +434,14 @@ void TaskRunner::startCycle() void TaskRunner::registerToBookkeeping() { - // register ourselves to the BK at the first cycle - ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM; - try { - Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, ""); - } catch (std::runtime_error& error) { - ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; + if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration + // register ourselves to the BK at the first cycle + ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM; + try { + Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, ""); + } catch (std::runtime_error& error) { + ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; + } } } From dec5587716d49709f77b3247fe0292757c5e498a Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 3 Dec 2025 13:15:00 +0100 Subject: [PATCH 2/4] [QC-1322] Call the BK registration within a thread. --- Framework/src/Bookkeeping.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Framework/src/Bookkeeping.cxx b/Framework/src/Bookkeeping.cxx index aae2f505e1..377ef6c95e 100644 --- a/Framework/src/Bookkeeping.cxx +++ b/Framework/src/Bookkeeping.cxx @@ -22,6 +22,7 @@ #include #include #include +#include using namespace o2::bkp::api; @@ -113,7 +114,14 @@ void Bookkeeping::registerProcess(int runNumber, const std::string& name, const if (!mInitialized) { return; } - mClient->dplProcessExecution()->registerProcessExecution(runNumber, type, getHostName(), name, args, detector); + + std::thread([this, runNumber, type, name, args, detector]() { + try{ + this->mClient->dplProcessExecution()->registerProcessExecution(runNumber, type, getHostName(), name, args, detector); + } catch (std::runtime_error& error) { // catch here because we are in a thread + ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; + } + }).detach(); } std::vector Bookkeeping::sendFlagsForSynchronous(uint32_t runNumber, const std::string& detectorName, const std::vector& qcFlags) From c591bbe49f2cefe3cec24c6cc7ff2e757f0348b7 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 4 Dec 2025 14:06:39 +0100 Subject: [PATCH 3/4] remove the useless try catch --- Framework/src/AggregatorRunner.cxx | 6 +----- Framework/src/CheckRunner.cxx | 6 +----- Framework/src/PostProcessingRunner.cxx | 6 +----- Framework/src/TaskRunner.cxx | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index cb66bf1ce8..ddcea3ae4f 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -380,11 +380,7 @@ void AggregatorRunner::start(ServiceRegistryRef services) // register ourselves to the BK if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration ILOG(Debug, Devel) << "Registering aggregator to BookKeeping" << ENDM; - try { - Bookkeeping::getInstance().registerProcess(mActivity->mId, mDeviceName, AggregatorRunner::getDetectorName(mAggregators), bkp::DplProcessType::QC_AGGREGATOR, ""); - } catch (std::runtime_error& error) { - ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; - } + Bookkeeping::getInstance().registerProcess(mActivity->mId, mDeviceName, AggregatorRunner::getDetectorName(mAggregators), bkp::DplProcessType::QC_AGGREGATOR, ""); } } diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index 32328f92e1..f4de104961 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -457,11 +457,7 @@ void CheckRunner::start(ServiceRegistryRef services) // register ourselves to the BK if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration ILOG(Debug, Devel) << "Registering checkRunner to BookKeeping" << ENDM; - try { - Bookkeeping::getInstance().registerProcess(mActivity->mId, mDeviceName, mDetectorName, bkp::DplProcessType::QC_CHECKER, ""); - } catch (std::runtime_error& error) { - ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; - } + Bookkeeping::getInstance().registerProcess(mActivity->mId, mDeviceName, mDetectorName, bkp::DplProcessType::QC_CHECKER, ""); } } diff --git a/Framework/src/PostProcessingRunner.cxx b/Framework/src/PostProcessingRunner.cxx index 24d596cf49..294ef12075 100644 --- a/Framework/src/PostProcessingRunner.cxx +++ b/Framework/src/PostProcessingRunner.cxx @@ -189,11 +189,7 @@ void PostProcessingRunner::start(framework::ServiceRegistryRef dplServices) // register ourselves to the BK if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration ILOG(Debug, Devel) << "Registering pp task to BookKeeping" << ENDM; - try { - Bookkeeping::getInstance().registerProcess(mActivity.mId, mRunnerConfig.taskName, mRunnerConfig.detectorName, bkp::DplProcessType::QC_POSTPROCESSING, ""); - } catch (std::runtime_error& error) { - ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; - } + Bookkeeping::getInstance().registerProcess(mActivity.mId, mRunnerConfig.taskName, mRunnerConfig.detectorName, bkp::DplProcessType::QC_POSTPROCESSING, ""); } if (mTaskState == TaskState::Created || mTaskState == TaskState::Finished) { diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 613763c8dd..372ab19962 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -437,11 +437,7 @@ void TaskRunner::registerToBookkeeping() if (!gSystem->Getenv("O2_QC_DONT_REGISTER_IN_BK")) { // Set this variable to disable the registration // register ourselves to the BK at the first cycle ILOG(Debug, Devel) << "Registering taskRunner to BookKeeping" << ENDM; - try { - Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, ""); - } catch (std::runtime_error& error) { - ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM; - } + Bookkeeping::getInstance().registerProcess(mActivity.mId, mTaskConfig.taskName, mTaskConfig.detectorName, bkp::DplProcessType::QC_TASK, ""); } } From 933d4569e9fbaffac875a01c52648898c27be90f Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 4 Dec 2025 14:08:58 +0100 Subject: [PATCH 4/4] format --- Framework/src/Bookkeeping.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/src/Bookkeeping.cxx b/Framework/src/Bookkeeping.cxx index 377ef6c95e..d779ff1e57 100644 --- a/Framework/src/Bookkeeping.cxx +++ b/Framework/src/Bookkeeping.cxx @@ -116,7 +116,7 @@ void Bookkeeping::registerProcess(int runNumber, const std::string& name, const } std::thread([this, runNumber, type, name, args, detector]() { - try{ + try { this->mClient->dplProcessExecution()->registerProcessExecution(runNumber, type, getHostName(), name, args, detector); } catch (std::runtime_error& error) { // catch here because we are in a thread ILOG(Warning, Devel) << "Failed registration to the BookKeeping: " << error.what() << ENDM;