From 58bed27870428e8fd3429e8df720b92bcf47b5d7 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 11 Sep 2024 12:32:35 +0200 Subject: [PATCH] [QC-1231] Remove the retrieval of qcConfiguration in init --- .../include/QualityControl/AggregatorRunner.h | 2 - .../include/QualityControl/CheckRunner.h | 3 -- Framework/include/QualityControl/TaskRunner.h | 1 - Framework/src/AggregatorRunner.cxx | 43 ------------------- Framework/src/CheckRunner.cxx | 41 ------------------ Framework/src/TaskRunner.cxx | 39 ----------------- 6 files changed, 129 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 84aebaadd8..bec022a223 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -142,8 +142,6 @@ class AggregatorRunner : public framework::Task void send(const QualityObjectsWithAggregatorNameVector&, framework::DataAllocator&); - void refreshConfig(framework::InitContext& iCtx); - /** * Prepare the inputs, remove the duplicates */ diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index 90a5f13f30..80c281ab8b 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -211,9 +211,6 @@ class CheckRunner : public framework::Task /// \brief Callback for CallbackService::Id::Reset (DPL) a.k.a. RESET DEVICE transition (FairMQ) void reset(); - /// Refresh the configuration using the payload found in the fairmq options (if available) - void refreshConfig(framework::InitContext& iCtx); - // General state std::string mDeviceName; std::map mChecks; diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index 5904af1fcd..73a5d3a0a9 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -129,7 +129,6 @@ class TaskRunner : public framework::Task /// \brief Checks if all the expected data inputs are present in the provided InputRecord static bool isDataReady(const framework::InputRecord& inputs); - void refreshConfig(framework::InitContext& iCtx); void printTaskConfig() const; void startOfActivity(); void endOfActivity(); diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 7963692f1e..6a283264bf 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -78,48 +78,6 @@ AggregatorRunner::~AggregatorRunner() } } -void AggregatorRunner::refreshConfig(InitContext& iCtx) -{ - try { - auto updatedTree = iCtx.options().get("qcConfiguration"); - - if (updatedTree.empty()) { - ILOG(Warning, Devel) << "Templated config tree is empty, we continue with the original one" << ENDM; - } else { - if (gSystem->Getenv("O2_QC_DEBUG_CONFIG_TREE")) { // until we are sure it works, keep a backdoor - ILOG(Debug, Devel) << "We print the tree we got from the ECS via DPL : " << ENDM; - printTree(updatedTree); - } - - // read the config, prepare spec - auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree, workflow_type_helpers::getWorkflowType(iCtx.options())); - - // replace the runner config - mRunnerConfig = AggregatorRunnerFactory::extractRunnerConfig(infrastructureSpec.common); - - // replace the aggregators configs - mAggregatorsConfig.clear(); - mAggregatorsConfig = AggregatorRunnerFactory::extractAggregatorsConfig(infrastructureSpec.common, infrastructureSpec.aggregators); - - // replace the inputs - mInputs.clear(); - prepareInputs(); - - mOutputs.clear(); - prepareOutputs(); - - ILOG(Debug, Devel) << "Configuration refreshed" << ENDM; - } - } catch (std::invalid_argument& error) { - // ignore the error, we just skip the update of the config file. It can be legit, e.g. in command line mode - ILOG(Warning, Devel) << "Could not get updated config tree in TaskRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; - } catch (...) { - // we catch here because we don't know where it will get lost in DPL, and also we don't care if this part has failed. - ILOG(Warning, Devel) << "Error caught in refreshConfig(): " - << current_diagnostic(true) << ENDM; - } -} - void AggregatorRunner::prepareInputs() { std::set alreadySeen; @@ -158,7 +116,6 @@ std::string AggregatorRunner::createAggregatorRunnerName() void AggregatorRunner::init(framework::InitContext& iCtx) { core::initInfologger(iCtx, mRunnerConfig.infologgerDiscardParameters, "aggregator"); - refreshConfig(iCtx); QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); Bookkeeping::getInstance().init(mRunnerConfig.bookkeepingUrl); diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index e231e9131e..ac96a12a65 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -169,51 +169,10 @@ CheckRunner::~CheckRunner() } } -void CheckRunner::refreshConfig(InitContext& iCtx) -{ - try { - // get the tree - auto updatedTree = iCtx.options().get("qcConfiguration"); - - if (updatedTree.empty()) { - ILOG(Warning, Devel) << "Templated config tree is empty, we continue with the original one" << ENDM; - } else { - if (gSystem->Getenv("O2_QC_DEBUG_CONFIG_TREE")) { // until we are sure it works, keep a backdoor - ILOG(Debug, Devel) << "We print the tree we got from the ECS via DPL : " << ENDM; - printTree(updatedTree); - } - - // prepare the information we need - auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree, workflow_type_helpers::getWorkflowType(iCtx.options())); - - // Use the config to reconfigure the check runner. - // The configs for the checks we find in the config and in our map are updated. - // Topology changes are ignored: New checks are ignored. Removed checks are ignored. - for (const auto& checkSpec : infrastructureSpec.checks) { - // search if we have this check in this runner and replace it - if (mChecks.find(checkSpec.checkName) != mChecks.end()) { - auto checkConfig = Check::extractConfig(infrastructureSpec.common, checkSpec); - mChecks.erase(checkConfig.name); - mChecks.emplace(checkConfig.name, checkConfig); - ILOG(Debug, Devel) << "Check " << checkSpec.checkName << " has been updated" << ENDM; - } - } - } - } catch (std::invalid_argument& error) { - // ignore the error, we just skip the update of the config file. It can be legit, e.g. in command line mode - ILOG(Warning, Devel) << "Could not get updated config tree in CheckRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; - } catch (...) { - // we catch here because we don't know where it will get lost in DPL, and also we don't care if this part has failed. - ILOG(Warning, Devel) << "Error caught in CheckRunner::refreshConfig(): " - << current_diagnostic(true) << ENDM; - } -} - void CheckRunner::init(framework::InitContext& iCtx) { try { core::initInfologger(iCtx, mConfig.infologgerDiscardParameters, createCheckRunnerFacility(mDeviceName)); - refreshConfig(iCtx); Bookkeeping::getInstance().init(mConfig.bookkeepingUrl); initDatabase(); initMonitoring(); diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index dd7c020b21..9f1a418104 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,50 +81,11 @@ TaskRunner::~TaskRunner() ILOG(Debug, Trace) << "TaskRunner destructor (" << this << ")" << ENDM; } -void TaskRunner::refreshConfig(InitContext& iCtx) -{ - try { - // get the tree - auto updatedTree = iCtx.options().get("qcConfiguration"); - - if (updatedTree.empty()) { - ILOG(Warning, Devel) << "Templated config tree is empty, we continue with the original one" << ENDM; - } else { - if (gSystem->Getenv("O2_QC_DEBUG_CONFIG_TREE")) { // until we are sure it works, keep a backdoor - ILOG(Debug, Devel) << "We print the tree we got from the ECS via DPL : " << ENDM; - printTree(updatedTree); - } - - // prepare the information we need - auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree, workflow_type_helpers::getWorkflowType(iCtx.options())); - // find the correct taskSpec - auto taskSpecIter = find_if(infrastructureSpec.tasks.begin(), - infrastructureSpec.tasks.end(), - [this](const TaskSpec& ts) { return ts.taskName == mTaskConfig.taskName; }); - if (taskSpecIter != infrastructureSpec.tasks.end()) { - bool runningWithMergers = mTaskConfig.parallelTaskID != 0; // it is 0 when we are the one and only task instance. - int resetAfterCycles = TaskRunnerFactory::computeResetAfterCycles(*taskSpecIter, runningWithMergers); - mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *taskSpecIter, mTaskConfig.parallelTaskID, resetAfterCycles); - ILOG(Debug, Devel) << "Configuration refreshed" << ENDM; - } else { - ILOG(Error, Support) << "Could not find the task " << mTaskConfig.taskName << " in the templated config provided by ECS, we continue with the original config" << ENDM; - } - } - } catch (std::invalid_argument& error) { - // ignore the error, we just skip the update of the config file. It can be legit, e.g. in command line mode - ILOG(Warning, Devel) << "Could not get updated config tree in TaskRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; - } catch (...) { - // we catch here because we don't know where it will get lost in dpl, and also we don't care if this part has failed. - ILOG(Warning, Devel) << "Error caught in refreshConfig() : " << current_diagnostic(true) << ENDM; - } -} - void TaskRunner::init(InitContext& iCtx) { core::initInfologger(iCtx, mTaskConfig.infologgerDiscardParameters, "task/" + mTaskConfig.taskName, mTaskConfig.detectorName); ILOG(Info, Devel) << "Initializing TaskRunner" << ENDM; - refreshConfig(iCtx); printTaskConfig(); Bookkeeping::getInstance().init(mTaskConfig.bookkeepingUrl);