From b56b64aba571bab08d2aee35bf5fd233b38907c1 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 2 Dec 2021 10:58:58 +0100 Subject: [PATCH 01/36] pushed config in taskrunner --- Framework/src/TaskRunner.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index dd7ec4d695..312da9d63a 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -37,6 +37,7 @@ #include #include +#include using namespace std; @@ -76,6 +77,16 @@ void TaskRunner::init(InitContext& iCtx) ilContext); ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; + + // get a fresh config + ILOG(Debug, Devel) << "update tree in init()" << ENDM; + try { + auto updatedTree = iCtx.options().get("myConfigPayload"); + } 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()" << ENDM; + } + try { loadTaskConfig(); } catch (...) { From 61cca547fb6b4b4de58af0e49a13dff66806df74 Mon Sep 17 00:00:00 2001 From: Barthelemy von Haller Date: Thu, 2 Dec 2021 12:10:50 +0100 Subject: [PATCH 02/36] correct name --- Framework/src/TaskRunner.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 312da9d63a..2300e602a7 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,7 +81,7 @@ void TaskRunner::init(InitContext& iCtx) // get a fresh config ILOG(Debug, Devel) << "update tree in init()" << ENDM; try { - auto updatedTree = iCtx.options().get("myConfigPayload"); + auto updatedTree = iCtx.options().get("qcConfiguration"); } 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()" << ENDM; From 53cdd0bd2c720ab16bca3abd59ae991da88cf769 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 2 Dec 2021 12:12:20 +0100 Subject: [PATCH 03/36] more output --- Framework/src/TaskRunner.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 2300e602a7..3d4f097f98 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -79,12 +79,12 @@ void TaskRunner::init(InitContext& iCtx) ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; // get a fresh config - ILOG(Debug, Devel) << "update tree in init()" << ENDM; + ILOG(Debug, Devel) << "update tree in init() with the content of option qcConfiguration" << ENDM; try { auto updatedTree = iCtx.options().get("qcConfiguration"); } 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()" << ENDM; + ILOG(Warning, Devel) << "Could not get updated config tree in TaskRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; } try { From 79c482ef81b068536350e0f88b0769c302081bf5 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 2 Dec 2021 16:25:47 +0100 Subject: [PATCH 04/36] with Giulio's magic line --- Framework/src/TaskRunner.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 3d4f097f98..8008ce4f49 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,6 +81,7 @@ void TaskRunner::init(InitContext& iCtx) // get a fresh config ILOG(Debug, Devel) << "update tree in init() with the content of option qcConfiguration" << ENDM; try { + mTaskConfig.options.push_back(ConfigParamSpec{"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"}}); auto updatedTree = iCtx.options().get("qcConfiguration"); } 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 From 60bf80dee6bc0266c37049a5d2c7b416117de3f0 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 3 Dec 2021 15:23:18 +0100 Subject: [PATCH 05/36] fixfff --- Framework/src/TaskRunnerFactory.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index c72c5093a9..607f1d5d21 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -22,6 +22,13 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include namespace o2::quality_control::core { @@ -75,7 +82,8 @@ TaskRunnerConfig TaskRunnerFactory::extractConfig(const CommonSpec& globalConfig Options options{ { "period-timer-cycle", framework::VariantType::Int, static_cast(taskSpec.cycleDurationSeconds * 1000000), { "timer period" } }, - { "runNumber", framework::VariantType::String, { "Run number" } } + { "runNumber", framework::VariantType::String, { "Run number" } }, + {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } }; return { From e51a0c53040bc557402f56fb6033ab3801bb0731 Mon Sep 17 00:00:00 2001 From: Barthelemy von Haller Date: Mon, 6 Dec 2021 15:13:21 +0100 Subject: [PATCH 06/36] error printing --- Framework/src/TaskRunner.cxx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 8008ce4f49..606b0cb8b0 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -79,12 +79,13 @@ void TaskRunner::init(InitContext& iCtx) ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; // get a fresh config - ILOG(Debug, Devel) << "update tree in init() with the content of option qcConfiguration" << ENDM; + ILOG(Debug, Devel) << "update 2 tree in init() with the content of option qcConfiguration" << ENDM; try { - mTaskConfig.options.push_back(ConfigParamSpec{"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"}}); + // mTaskConfig.options.push_back(ConfigParamSpec{"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"}}); auto updatedTree = iCtx.options().get("qcConfiguration"); } 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) << error.what() << ENDM; ILOG(Warning, Devel) << "Could not get updated config tree in TaskRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; } From 01a1d1ad8aaa49b3b5a762dfbf777487ed1ab535 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 8 Dec 2021 13:21:29 +0100 Subject: [PATCH 07/36] print the tree --- .../include/QualityControl/runnerUtils.h | 39 +++++++++++++++++++ Framework/src/TaskRunner.cxx | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index dd932301dd..d2b7356171 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -119,6 +119,45 @@ inline std::string computeProvenance(const std::string& fallbackProvenance = "") return provenance; } +std::string indent(int level) +{ + std::string s; + for (int i = 0; ifirst << "\": "; + + printTree(pos->second, level + 1); + ++pos; + if (pos != pt.end()) + { + std::cout << ","; + } + std::cout << std::endl; + } + + std::cout << indent(level) << " }"; + } + std::cout << std::endl; + return; +} + } // namespace o2::quality_control::core #endif //QUALITYCONTROL_RUNNERUTILS_H \ No newline at end of file diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 606b0cb8b0..39c444aaf3 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,8 +81,8 @@ void TaskRunner::init(InitContext& iCtx) // get a fresh config ILOG(Debug, Devel) << "update 2 tree in init() with the content of option qcConfiguration" << ENDM; try { - // mTaskConfig.options.push_back(ConfigParamSpec{"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"}}); auto updatedTree = iCtx.options().get("qcConfiguration"); + printTree(updatedTree); } 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) << error.what() << ENDM; From 3d23d4f8bcd1cc13e49b6bc8387816b1aaea792b Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 8 Dec 2021 13:23:52 +0100 Subject: [PATCH 08/36] print the tree --- Framework/include/QualityControl/runnerUtils.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index d2b7356171..b65e93c825 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -119,14 +119,14 @@ inline std::string computeProvenance(const std::string& fallbackProvenance = "") return provenance; } -std::string indent(int level) +inline std::string indentTree(int level) { std::string s; for (int i = 0; ifirst << "\": "; + std::cout << indentTree(level + 1) << "\"" << pos->first << "\": "; printTree(pos->second, level + 1); ++pos; @@ -152,7 +152,7 @@ void printTree(boost::property_tree::ptree &pt, int level=0) std::cout << std::endl; } - std::cout << indent(level) << " }"; + std::cout << indentTree(level) << " }"; } std::cout << std::endl; return; From 6067d5760cdcd7498f922bd08439cc04246832ec Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Wed, 8 Dec 2021 13:31:53 +0100 Subject: [PATCH 09/36] il --- .../include/QualityControl/runnerUtils.h | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index b65e93c825..389097649e 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -128,33 +128,30 @@ inline std::string indentTree(int level) inline void printTree(boost::property_tree::ptree &pt, int level=0) { - if (pt.empty()) - { - std::cout << "\"" << pt.data() << "\""; - } + if (pt.empty()) { - else - { - if (level) std::cout << std::endl; + ILOG(Debug, Devel) << "\"" << pt.data() << "\""; + } else { + if (level) { + ILOG(Debug, Devel) << ENDM; + } - std::cout << indentTree(level) << "{" << std::endl; + ILOG(Debug, Devel) << indentTree(level) << "{" << ENDM; - for (boost::property_tree::ptree::iterator pos = pt.begin(); pos != pt.end();) - { - std::cout << indentTree(level + 1) << "\"" << pos->first << "\": "; + for (boost::property_tree::ptree::iterator pos = pt.begin(); pos != pt.end();) { + ILOG(Debug, Devel) << indentTree(level + 1) << "\"" << pos->first << "\": "; printTree(pos->second, level + 1); ++pos; - if (pos != pt.end()) - { - std::cout << ","; + if (pos != pt.end()) { + ILOG(Debug, Devel) << ","; } - std::cout << std::endl; + ILOG(Debug, Devel) << ENDM; } - std::cout << indentTree(level) << " }"; + ILOG(Debug, Devel) << indentTree(level) << " }"; } - std::cout << std::endl; + ILOG(Debug, Devel) << ENDM; return; } From 82f4088770ae2abdd2189654f94eb1287d65c5b5 Mon Sep 17 00:00:00 2001 From: Barthelemy von Haller Date: Thu, 13 Jan 2022 08:11:10 +0100 Subject: [PATCH 10/36] working ? --- .../include/QualityControl/runnerUtils.h | 40 ++++++++++++++++++- Framework/src/TaskRunner.cxx | 16 ++++++++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index 389097649e..5eca21cb42 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -130,7 +130,7 @@ inline void printTree(boost::property_tree::ptree &pt, int level=0) { if (pt.empty()) { - ILOG(Debug, Devel) << "\"" << pt.data() << "\""; + ILOG(Debug, Devel) <<"\"" << pt.data() << "\""; } else { if (level) { ILOG(Debug, Devel) << ENDM; @@ -155,6 +155,42 @@ inline void printTree(boost::property_tree::ptree &pt, int level=0) return; } + using namespace std; + + inline void printTreeToFile(boost::property_tree::ptree &pt, stringstream& ss, int level=0) +{ + // Create and open a text file + // ofstream MyFile("/tmp/ptreedump.txt"); + if (pt.empty()) { + + ss << "\"" << pt.data() << "\""; + } else { + if (level) { + ss << "\n"; + } + + ss << indentTree(level) << "{\n"; + + for (boost::property_tree::ptree::iterator pos = pt.begin(); pos != pt.end();) { + ss<< indentTree(level + 1) << "\"" << pos->first << "\": "; + + printTreeToFile(pos->second, ss, level + 1); + ++pos; + if (pos != pt.end()) { + ss <(""); + /* ILOG(Debug, Devel) << "print whole tree: " << ENDM; + auto wholeTree = iCtx.options().get(""); + printTree(wholeTree); + std::stringstream ss; + printTreeToFile(wholeTree, ss, 0); + // Create and open a text file + ofstream MyFile("/tmp/dump.txt"); + MyFile << ss.str(); + MyFile.close(); + */ + auto updatedTree = iCtx.options().get("qcConfiguration"); + // auto updatedTree = iCtx.services().get().device()->fConfig->GetProperty< boost::property_tree::ptree>("qcConfiguration"); + + ILOG(Debug,Devel) << "print the updated tree : " << ENDM; + // cout << "print tree: " << endl; printTree(updatedTree); } 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 From 11148fdc8f2a48b703250a84e7a7a831edeaf275 Mon Sep 17 00:00:00 2001 From: Barthelemy von Haller Date: Thu, 13 Jan 2022 09:02:35 +0100 Subject: [PATCH 11/36] say if empty --- Framework/src/TaskRunner.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 47f360ed12..9e5bc9d656 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -97,8 +97,11 @@ void TaskRunner::init(InitContext& iCtx) // auto updatedTree = iCtx.services().get().device()->fConfig->GetProperty< boost::property_tree::ptree>("qcConfiguration"); ILOG(Debug,Devel) << "print the updated tree : " << ENDM; - // cout << "print tree: " << endl; - printTree(updatedTree); + if(updatedTree.empty()) { + ILOG(Error, Devel) << " Updated tree is empty" << ENDM; + } else { + printTree(updatedTree); + } } 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) << error.what() << ENDM; From c1482ae2ef38a62baec94963fa9f85bd11833df1 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 13 Dec 2021 10:57:50 +0100 Subject: [PATCH 12/36] Use the config and fix a wrong guard in the header. --- .../include/QualityControl/TaskRunnerFactory.h | 6 +++--- Framework/src/TaskRunner.cxx | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Framework/include/QualityControl/TaskRunnerFactory.h b/Framework/include/QualityControl/TaskRunnerFactory.h index 326d50a671..95be54833d 100644 --- a/Framework/include/QualityControl/TaskRunnerFactory.h +++ b/Framework/include/QualityControl/TaskRunnerFactory.h @@ -14,8 +14,8 @@ /// \author Piotr Konopka /// -#ifndef QC_CORE_TASKFACTORY_H -#define QC_CORE_TASKFACTORY_H +#ifndef QC_CORE_TASKRUNNERFACTORY_H +#define QC_CORE_TASKRUNNERFACTORY_H #include #include @@ -59,4 +59,4 @@ class TaskRunnerFactory } // namespace o2::quality_control::core -#endif // QC_CORE_TASKFACTORY_H +#endif // QC_CORE_TASKRUNNERFACTORY_H diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 9e5bc9d656..1caa6a55a0 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,7 +81,7 @@ void TaskRunner::init(InitContext& iCtx) // get a fresh config ILOG(Debug, Devel) << "update 2 tree in init() with the content of option qcConfiguration" << ENDM; try { - // auto wholeTree = iCtx.options().get(""); + // auto wholeTree = iCtx.options().get(""); /* ILOG(Debug, Devel) << "print whole tree: " << ENDM; auto wholeTree = iCtx.options().get(""); printTree(wholeTree); @@ -93,15 +93,27 @@ void TaskRunner::init(InitContext& iCtx) MyFile.close(); */ + // get the tree auto updatedTree = iCtx.options().get("qcConfiguration"); // auto updatedTree = iCtx.services().get().device()->fConfig->GetProperty< boost::property_tree::ptree>("qcConfiguration"); ILOG(Debug,Devel) << "print the updated tree : " << ENDM; if(updatedTree.empty()) { - ILOG(Error, Devel) << " Updated tree is empty" << ENDM; + ILOG(Error, Devel) << " Updated tree is empty" << ENDM; } else { printTree(updatedTree); } + // prepare the information we need + auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); + // find the correct taskSpec + auto it = find_if(infrastructureSpec.tasks.begin(), + infrastructureSpec.tasks.end(), + [this](const TaskSpec& ts) {return ts.taskName == mTaskConfig.taskName;}); + if (it != infrastructureSpec.tasks.end()) { + mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); + } else { + ILOG(Error, Support) << "Could not consume the templated config provided by ECS, we continue with the original one" << 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) << error.what() << ENDM; From 0294888ce0e16c85a493e784838243a3ce7fab27 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 13 Jan 2022 09:21:38 +0100 Subject: [PATCH 13/36] handle the config --- Framework/src/TaskRunner.cxx | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 1caa6a55a0..abbfb0e629 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -34,6 +34,8 @@ #include "QualityControl/QcInfoLogger.h" #include "QualityControl/TaskFactory.h" #include "QualityControl/runnerUtils.h" +#include "QualityControl/InfrastructureSpecReader.h" +#include "QualityControl/TaskRunnerFactory.h" #include #include @@ -95,24 +97,24 @@ void TaskRunner::init(InitContext& iCtx) // get the tree auto updatedTree = iCtx.options().get("qcConfiguration"); - // auto updatedTree = iCtx.services().get().device()->fConfig->GetProperty< boost::property_tree::ptree>("qcConfiguration"); - ILOG(Debug,Devel) << "print the updated tree : " << ENDM; if(updatedTree.empty()) { - ILOG(Error, Devel) << " Updated tree is empty" << ENDM; + ILOG(Warning, Devel) << "Templated config tree is empty, we continue with the original one" << ENDM; } else { + ILOG(Debug,Devel) << "print the updated tree : " << ENDM; printTree(updatedTree); - } - // prepare the information we need - auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); - // find the correct taskSpec - auto it = find_if(infrastructureSpec.tasks.begin(), - infrastructureSpec.tasks.end(), - [this](const TaskSpec& ts) {return ts.taskName == mTaskConfig.taskName;}); - if (it != infrastructureSpec.tasks.end()) { - mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); - } else { - ILOG(Error, Support) << "Could not consume the templated config provided by ECS, we continue with the original one" << ENDM; + + // prepare the information we need + auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); + // find the correct taskSpec + auto it = find_if(infrastructureSpec.tasks.begin(), + infrastructureSpec.tasks.end(), + [this](const TaskSpec& ts) {return ts.taskName == mTaskConfig.taskName;}); + if (it != infrastructureSpec.tasks.end()) { + mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); + } else { + ILOG(Error, Support) << "Could not consume the templated config provided by ECS, we continue with the original one" << 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 From 129688bb6b16dbdbce05b4d4f9b6343213a9bc55 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 13 Jan 2022 10:31:17 +0100 Subject: [PATCH 14/36] clean up and extraction --- Framework/include/QualityControl/TaskRunner.h | 1 + .../include/QualityControl/runnerUtils.h | 36 ---------- Framework/src/TaskRunner.cxx | 65 +++++++++---------- 3 files changed, 31 insertions(+), 71 deletions(-) diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index c1770bf038..a62a468b3c 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -112,6 +112,7 @@ class TaskRunner : public framework::Task void reset(); std::tuple validateInputs(const framework::InputRecord&); + void refreshConfig(framework::InitContext& iCtx); void loadTaskConfig(); void startOfActivity(); void endOfActivity(); diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index 5eca21cb42..324b86bf70 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -155,42 +155,6 @@ inline void printTree(boost::property_tree::ptree &pt, int level=0) return; } - using namespace std; - - inline void printTreeToFile(boost::property_tree::ptree &pt, stringstream& ss, int level=0) -{ - // Create and open a text file - // ofstream MyFile("/tmp/ptreedump.txt"); - if (pt.empty()) { - - ss << "\"" << pt.data() << "\""; - } else { - if (level) { - ss << "\n"; - } - - ss << indentTree(level) << "{\n"; - - for (boost::property_tree::ptree::iterator pos = pt.begin(); pos != pt.end();) { - ss<< indentTree(level + 1) << "\"" << pos->first << "\": "; - - printTreeToFile(pos->second, ss, level + 1); - ++pos; - if (pos != pt.end()) { - ss < #include #include +#include using namespace std; @@ -62,47 +63,19 @@ TaskRunner::TaskRunner(const TaskRunnerConfig& config) { } -void TaskRunner::init(InitContext& iCtx) +void TaskRunner::refreshConfig(InitContext& iCtx) { - AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; - try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM; - } - QcInfoLogger::init("task/" + mTaskConfig.taskName, - mTaskConfig.infologgerFilterDiscardDebug, - mTaskConfig.infologgerDiscardLevel, - il, - ilContext); - - ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; - - // get a fresh config - ILOG(Debug, Devel) << "update 2 tree in init() with the content of option qcConfiguration" << ENDM; try { - // auto wholeTree = iCtx.options().get(""); - /* ILOG(Debug, Devel) << "print whole tree: " << ENDM; - auto wholeTree = iCtx.options().get(""); - printTree(wholeTree); - std::stringstream ss; - printTreeToFile(wholeTree, ss, 0); - // Create and open a text file - ofstream MyFile("/tmp/dump.txt"); - MyFile << ss.str(); - MyFile.close(); - */ - // 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 { - ILOG(Debug,Devel) << "print the updated tree : " << ENDM; - printTree(updatedTree); + 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); @@ -112,15 +85,37 @@ void TaskRunner::init(InitContext& iCtx) [this](const TaskSpec& ts) {return ts.taskName == mTaskConfig.taskName;}); if (it != infrastructureSpec.tasks.end()) { mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); + ILOG(Debug, Devel) << "Configuration refreshed" << ENDM; } else { - ILOG(Error, Support) << "Could not consume the templated config provided by ECS, we continue with the original one" << ENDM; + 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) << error.what() << ENDM; ILOG(Warning, Devel) << "Could not get updated config tree in TaskRunner::init() - `qcConfiguration` could not be retrieved" << ENDM; } +} + +void TaskRunner::init(InitContext& iCtx) +{ + AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr; + AliceO2::InfoLogger::InfoLogger* il = nullptr; + try { + ilContext = &iCtx.services().get(); + il = &iCtx.services().get(); + } catch (const RuntimeErrorRef& err) { + ILOG(Error, Devel) << "Could not find the DPL InfoLogger" << ENDM; + } + QcInfoLogger::init("task/" + mTaskConfig.taskName, + mTaskConfig.infologgerFilterDiscardDebug, + mTaskConfig.infologgerDiscardLevel, + il, + ilContext); + + ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; + + refreshConfig(iCtx); try { loadTaskConfig(); From 5daf7f9131c576fbb5192a9ddac989f8dc0e06f6 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Thu, 13 Jan 2022 17:15:44 +0100 Subject: [PATCH 15/36] Add the label qc-reconfigurable --- Framework/include/QualityControl/CheckRunner.h | 2 +- Framework/include/QualityControl/TaskRunner.h | 2 +- Framework/src/AggregatorRunnerFactory.cxx | 2 ++ Framework/src/CheckRunnerFactory.cxx | 6 ++++-- Framework/src/TaskRunnerFactory.cxx | 11 +++++++---- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index dd3705c4f4..9f1aab6eb9 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -114,7 +114,7 @@ class CheckRunner : public framework::Task void setTaskStoreSet(std::unordered_set storeSet) { mInputStoreSet = storeSet; } std::string getDeviceName() { return mDeviceName; }; - static framework::DataProcessorLabel getLabel() { return { "qc-check-runner" }; } + static framework::DataProcessorLabel getCheckLabel() { return { "qc-check-runner" }; } static std::string createCheckRunnerIdString() { return "QC-CHECK-RUNNER"; }; static std::string createCheckRunnerName(const std::vector& checks); static std::string createSinkCheckRunnerName(o2::framework::InputSpec input); diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index a62a468b3c..c2f9b55dfc 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -90,7 +90,7 @@ class TaskRunner : public framework::Task const framework::Options& getOptions() const { return mTaskConfig.options; }; /// \brief Data Processor Label to identify all Task Runners - static framework::DataProcessorLabel getLabel() { return { "qc-task-runner" }; } + static framework::DataProcessorLabel getTaskLabel() { return { "qc-task-runner" }; } /// \brief ID string for all TaskRunner devices static std::string createTaskRunnerIdString(); /// \brief Unified DataOrigin for Quality Control tasks diff --git a/Framework/src/AggregatorRunnerFactory.cxx b/Framework/src/AggregatorRunnerFactory.cxx index 9311dfb42f..42019341da 100644 --- a/Framework/src/AggregatorRunnerFactory.cxx +++ b/Framework/src/AggregatorRunnerFactory.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include "QualityControl/AggregatorRunner.h" #include "QualityControl/AggregatorRunnerFactory.h" @@ -42,6 +43,7 @@ DataProcessorSpec AggregatorRunnerFactory::create(AggregatorRunnerConfig arc, st AlgorithmSpec{}, Options{} }; + newAggregatorRunner.labels.emplace_back(o2::framework::ecs::qcReconfigurable); newAggregatorRunner.labels.emplace_back(AggregatorRunner::getLabel()); newAggregatorRunner.algorithm = adaptFromTask(std::move(aggregator)); return newAggregatorRunner; diff --git a/Framework/src/CheckRunnerFactory.cxx b/Framework/src/CheckRunnerFactory.cxx index 630c1c4701..3032441b1c 100644 --- a/Framework/src/CheckRunnerFactory.cxx +++ b/Framework/src/CheckRunnerFactory.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include "QualityControl/CheckRunner.h" #include "QualityControl/CheckRunnerFactory.h" @@ -40,7 +41,8 @@ DataProcessorSpec CheckRunnerFactory::create(CheckRunnerConfig checkRunnerConfig Outputs{ qcCheckRunner.getOutputs() }, AlgorithmSpec{}, Options{} }; - newCheckRunner.labels.emplace_back(CheckRunner::getLabel()); + newCheckRunner.labels.emplace_back(o2::framework::ecs::qcReconfigurable); + newCheckRunner.labels.emplace_back(CheckRunner::getCheckLabel()); newCheckRunner.algorithm = adaptFromTask(std::move(qcCheckRunner)); return newCheckRunner; } @@ -63,7 +65,7 @@ DataProcessorSpec CheckRunnerFactory::createSinkDevice(CheckRunnerConfig checkRu void CheckRunnerFactory::customizeInfrastructure(std::vector& policies) { - auto matcher = [label = CheckRunner::getLabel()](framework::DeviceSpec const& device) { + auto matcher = [label = CheckRunner::getCheckLabel()](framework::DeviceSpec const& device) { return std::find(device.labels.begin(), device.labels.end(), label) != device.labels.end(); }; diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index 607f1d5d21..cfb195ada7 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -29,14 +29,16 @@ #include #include #include +#include +#include + namespace o2::quality_control::core { using namespace o2::framework; -o2::framework::DataProcessorSpec - TaskRunnerFactory::create(const TaskRunnerConfig& taskConfig) +o2::framework::DataProcessorSpec TaskRunnerFactory::create(const TaskRunnerConfig& taskConfig) { TaskRunner qcTask{ taskConfig }; @@ -47,7 +49,8 @@ o2::framework::DataProcessorSpec adaptFromTask(std::move(qcTask)), taskConfig.options }; - newTask.labels.emplace_back(TaskRunner::getLabel()); + newTask.labels.emplace_back(o2::framework::ecs::qcReconfigurable); + newTask.labels.emplace_back(TaskRunner::getTaskLabel()); return newTask; } @@ -116,7 +119,7 @@ TaskRunnerConfig TaskRunnerFactory::extractConfig(const CommonSpec& globalConfig void TaskRunnerFactory::customizeInfrastructure(std::vector& policies) { - auto matcher = [label = TaskRunner::getLabel()](framework::DeviceSpec const& device) { + auto matcher = [label = TaskRunner::getTaskLabel()](framework::DeviceSpec const& device) { return std::find(device.labels.begin(), device.labels.end(), label) != device.labels.end(); }; auto callback = TaskRunner::completionPolicyCallback; From a48795a6c03fe92983439983f46e2f091474c288 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 08:30:55 +0100 Subject: [PATCH 16/36] Rename loadTaskConfig to printTaskConfig --- Framework/include/QualityControl/TaskRunner.h | 2 +- Framework/src/TaskRunner.cxx | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index c2f9b55dfc..9029e03996 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -113,7 +113,7 @@ class TaskRunner : public framework::Task std::tuple validateInputs(const framework::InputRecord&); void refreshConfig(framework::InitContext& iCtx); - void loadTaskConfig(); + void printTaskConfig(); void startOfActivity(); void endOfActivity(); void startCycle(); diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 47ceced671..a49c2420ad 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -117,14 +117,8 @@ void TaskRunner::init(InitContext& iCtx) refreshConfig(iCtx); - try { - loadTaskConfig(); - } catch (...) { - // catch the configuration exception and print it to avoid losing it - ILOG(Fatal, Ops) << "Unexpected exception during configuration:\n" - << current_diagnostic(true) << ENDM; - throw; - } + QcInfoLogger::setDetector(mTaskConfig.detectorName); + printTaskConfig(); // registering state machine callbacks iCtx.services().get().set(CallbackService::Id::Start, [this, &services = iCtx.services()]() { start(services); }); @@ -349,12 +343,8 @@ std::tuple TaskRunner::validateInputs return { dataReady, timerReady }; } -void TaskRunner::loadTaskConfig() // todo consider renaming +void TaskRunner::printTaskConfig() { - ILOG(Info, Support) << "Loading configuration" << ENDM; - - QcInfoLogger::setDetector(mTaskConfig.detectorName); - ILOG(Info, Support) << "Configuration loaded : " << ENDM; ILOG(Info, Support) << ">> Task name : " << mTaskConfig.taskName << ENDM; ILOG(Info, Support) << ">> Module name : " << mTaskConfig.moduleName << ENDM; From 7a263bdca56343f20efa3d91d69eb83d82a9d654 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 10:25:17 +0100 Subject: [PATCH 17/36] Extract infologger initialization --- Framework/include/QualityControl/TaskRunner.h | 3 ++- Framework/src/TaskRunner.cxx | 14 +++++++++----- Framework/test/testTaskRunner.cxx | 4 ++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index 9029e03996..a00b910a73 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -113,7 +113,8 @@ class TaskRunner : public framework::Task std::tuple validateInputs(const framework::InputRecord&); void refreshConfig(framework::InitContext& iCtx); - void printTaskConfig(); + inline void initInfologger(framework::InitContext& iCtx); + inline void printTaskConfig(); void startOfActivity(); void endOfActivity(); void startCycle(); diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index a49c2420ad..b567212465 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -97,7 +97,7 @@ void TaskRunner::refreshConfig(InitContext& iCtx) } } -void TaskRunner::init(InitContext& iCtx) +void TaskRunner::initInfologger(InitContext& iCtx) { AliceO2::InfoLogger::InfoLoggerContext* ilContext = nullptr; AliceO2::InfoLogger::InfoLogger* il = nullptr; @@ -112,12 +112,16 @@ void TaskRunner::init(InitContext& iCtx) mTaskConfig.infologgerDiscardLevel, il, ilContext); + QcInfoLogger::setDetector(mTaskConfig.detectorName); +} + +void TaskRunner::init(InitContext& iCtx) +{ + initInfologger(iCtx); ILOG(Info, Support) << "Initializing TaskRunner" << ENDM; refreshConfig(iCtx); - - QcInfoLogger::setDetector(mTaskConfig.detectorName); printTaskConfig(); // registering state machine callbacks @@ -134,8 +138,8 @@ void TaskRunner::init(InitContext& iCtx) mObjectsManager = std::make_shared(mTaskConfig.taskName, mTaskConfig.className, mTaskConfig.detectorName, mTaskConfig.consulUrl, mTaskConfig.parallelTaskID); // setup user's task - TaskFactory f; - mTask.reset(f.create(mTaskConfig, mObjectsManager)); + TaskFactory factory; + mTask.reset(factory.create(mTaskConfig, mObjectsManager)); mTask->setMonitoring(mCollector); // init user's task diff --git a/Framework/test/testTaskRunner.cxx b/Framework/test/testTaskRunner.cxx index 873588c1a3..ffb23f61f1 100644 --- a/Framework/test/testTaskRunner.cxx +++ b/Framework/test/testTaskRunner.cxx @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(test_factory) BOOST_CHECK(taskRunner.algorithm.onInit != nullptr); - BOOST_REQUIRE_EQUAL(taskRunner.options.size(), 2); + BOOST_REQUIRE_EQUAL(taskRunner.options.size(), 3); BOOST_CHECK_EQUAL(taskRunner.options[0].name, "period-timer-cycle"); } @@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(test_task_runner) BOOST_CHECK_EQUAL(qcTask.getOutputSpec(), (OutputSpec{ { "mo" }, "QC", "abcTask-mo", 0, Lifetime::Sporadic })); - BOOST_REQUIRE_EQUAL(qcTask.getOptions().size(), 2); + BOOST_REQUIRE_EQUAL(qcTask.getOptions().size(), 3); BOOST_CHECK_EQUAL(qcTask.getOptions()[0].name, "period-timer-cycle"); // This is maximum that we can do until we are able to test the DPL algorithms in isolation. From 1a0f305e5875ddcfabdfda173e5d39d8684067ca Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 10:25:45 +0100 Subject: [PATCH 18/36] Extract infologger initialization Add config refresh but do not use it. --- .../include/QualityControl/CheckRunner.h | 4 ++ Framework/src/CheckRunner.cxx | 66 +++++++++++++++---- 2 files changed, 57 insertions(+), 13 deletions(-) diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index 9f1aab6eb9..e2763d7143 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -167,6 +167,7 @@ class CheckRunner : public framework::Task inline void initDatabase(); inline void initMonitoring(); inline void initServiceDiscovery(); + inline void initInfologger(framework::InitContext& iCtx); /** * Update the list of objects this TaskRunner is sending out. @@ -203,6 +204,9 @@ 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::vector mChecks; diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index c4af34df37..b0c2ea8478 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -29,6 +29,10 @@ #include "QualityControl/DatabaseFactory.h" #include "QualityControl/ServiceDiscovery.h" #include "QualityControl/runnerUtils.h" +#include "QualityControl/InfrastructureSpecReader.h" +#include "QualityControl/CheckRunnerFactory.h" + +#include using namespace std::chrono; using namespace AliceO2::Common; @@ -159,24 +163,43 @@ CheckRunner::~CheckRunner() } } -void CheckRunner::init(framework::InitContext& iCtx) +void CheckRunner::refreshConfig(InitContext& iCtx) { - InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; + // 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); + + // TODO: use the config to reconfigure the check runner. + // TODO: in particular, reset mChecks and update it. + // TODO: Problem is that a lot of the logic is in the infrastructure generator. + // TODO: we should probably just preserve the checks list and update their state. + + QcInfoLogger::setDetector(CheckRunner::getDetectorName(mChecks)); + } + } 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; } +} +void CheckRunner::init(framework::InitContext& iCtx) +{ try { - QcInfoLogger::init(createCheckRunnerFacility(mDeviceName), - mConfig.infologgerFilterDiscardDebug, - mConfig.infologgerDiscardLevel, - il, - ilContext); - QcInfoLogger::setDetector(CheckRunner::getDetectorName(mChecks)); + initInfologger(iCtx); + + refreshConfig(iCtx); + initDatabase(); initMonitoring(); initServiceDiscovery(); @@ -417,6 +440,23 @@ void CheckRunner::initServiceDiscovery() ILOG(Info, Support) << "ServiceDiscovery initialized" << ENDM; } +void CheckRunner::initInfologger(framework::InitContext& iCtx) +{ + InfoLoggerContext* ilContext = nullptr; + AliceO2::InfoLogger::InfoLogger* il = nullptr; + try { + ilContext = &iCtx.services().get(); + il = &iCtx.services().get(); + } catch (const RuntimeErrorRef& err) { + ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; + } + QcInfoLogger::init(createCheckRunnerFacility(mDeviceName), + mConfig.infologgerFilterDiscardDebug, + mConfig.infologgerDiscardLevel, + il, + ilContext); +} + void CheckRunner::start(const ServiceRegistry& services) { mActivity.mId = computeRunNumber(services, mConfig.fallbackRunNumber); From 65907b9403f3bdec76f88f0d947fa3942ca0d88b Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 11:17:27 +0100 Subject: [PATCH 19/36] Prepare aggregators for refresh --- .../include/QualityControl/AggregatorRunner.h | 6 ++- .../QualityControl/AggregatorRunnerFactory.h | 3 +- Framework/src/AggregatorRunner.cxx | 44 ++++++++++++++----- Framework/src/AggregatorRunnerFactory.cxx | 7 +-- Framework/src/InfrastructureGenerator.cxx | 10 +---- Framework/test/testAggregatorRunner.cxx | 4 +- 6 files changed, 47 insertions(+), 27 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 77b9e11dc1..41ff63282c 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -27,6 +27,7 @@ #include "QualityControl/Activity.h" #include "QualityControl/AggregatorRunnerConfig.h" #include "QualityControl/AggregatorConfig.h" +#include "QualityControl/InfrastructureSpec.h" namespace o2::framework { @@ -93,7 +94,7 @@ class AggregatorRunner : public framework::Task * @param arc AggregatorRunner Config * @param acs Aggregator configs */ - AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs); + AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); /// Destructor ~AggregatorRunner() override; @@ -135,6 +136,9 @@ class AggregatorRunner : public framework::Task */ void store(core::QualityObjectsType& qualityObjects); + inline void extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + + inline void initInfoLogger(framework::InitContext& iCtx); inline void initDatabase(); inline void initMonitoring(); inline void initServiceDiscovery(); diff --git a/Framework/include/QualityControl/AggregatorRunnerFactory.h b/Framework/include/QualityControl/AggregatorRunnerFactory.h index d4a44cd5bc..5fe500cb91 100644 --- a/Framework/include/QualityControl/AggregatorRunnerFactory.h +++ b/Framework/include/QualityControl/AggregatorRunnerFactory.h @@ -23,6 +23,7 @@ #include "QualityControl/CommonSpec.h" #include "QualityControl/AggregatorRunnerConfig.h" #include "QualityControl/AggregatorConfig.h" +#include "QualityControl/InfrastructureSpec.h" #include @@ -36,7 +37,7 @@ class AggregatorRunnerFactory AggregatorRunnerFactory() = default; virtual ~AggregatorRunnerFactory() = default; - static framework::DataProcessorSpec create(AggregatorRunnerConfig arc, std::vector acs); + static framework::DataProcessorSpec create(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); static void customizeInfrastructure(std::vector& policies); static AggregatorRunnerConfig extractConfig(const core::CommonSpec&); diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index d9ab971196..955f946e34 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -46,14 +46,15 @@ const auto current_diagnostic = boost::current_exception_diagnostic_information; namespace o2::quality_control::checker { -AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs) +AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) : mDeviceName(createAggregatorRunnerName()), mRunnerConfig(std::move(arc)), - mAggregatorsConfigs(acs), mTotalNumberObjectsReceived(0), mTotalNumberAggregatorExecuted(0), mTotalNumberObjectsProduced(0) { + extractConfigs(infrastructureSpec); + // Prepare the inputs, remove duplicates std::set alreadySeen; int i = 0; @@ -75,6 +76,16 @@ AggregatorRunner::~AggregatorRunner() } } +void AggregatorRunner::extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) +{ + for (const auto& aggregatorSpec : infrastructureSpec.aggregators) { + if (aggregatorSpec.active) { + ILOG(Debug, Devel) << ">> Aggregator name : " << aggregatorSpec.aggregatorName << ENDM; + mAggregatorsConfigs.emplace_back(Aggregator::extractConfig(infrastructureSpec.common, aggregatorSpec)); + } + } +} + header::DataDescription AggregatorRunner::createAggregatorRunnerDataDescription(const std::string& aggregatorName) { if (aggregatorName.empty()) { @@ -92,18 +103,13 @@ std::string AggregatorRunner::createAggregatorRunnerName() void AggregatorRunner::init(framework::InitContext& iCtx) { - InfoLoggerContext* ilContext = nullptr; - AliceO2::InfoLogger::InfoLogger* il = nullptr; - try { - ilContext = &iCtx.services().get(); - il = &iCtx.services().get(); - } catch (const RuntimeErrorRef& err) { - ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; - } + initInfoLogger(iCtx); + + // refresh + // reset mAggregatorsConfigs + // extractConfigs try { - QcInfoLogger::init("aggregator", mRunnerConfig.infologgerFilterDiscardDebug, mRunnerConfig.infologgerDiscardLevel, il, ilContext); - QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); initDatabase(); initMonitoring(); initServiceDiscovery(); @@ -247,6 +253,20 @@ void AggregatorRunner::initAggregators() reorderAggregators(); } +void AggregatorRunner::initInfoLogger(InitContext& iCtx) +{ + InfoLoggerContext* ilContext = nullptr; + AliceO2::InfoLogger::InfoLogger* il = nullptr; + try { + ilContext = &iCtx.services().get(); + il = &iCtx.services().get(); + } catch (const RuntimeErrorRef& err) { + ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; + } + QcInfoLogger::init("aggregator", mRunnerConfig.infologgerFilterDiscardDebug, mRunnerConfig.infologgerDiscardLevel, il, ilContext); + QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); +} + bool AggregatorRunner::areSourcesIn(const std::vector& sources, const std::vector>& aggregators) { diff --git a/Framework/src/AggregatorRunnerFactory.cxx b/Framework/src/AggregatorRunnerFactory.cxx index 42019341da..51ba8ce923 100644 --- a/Framework/src/AggregatorRunnerFactory.cxx +++ b/Framework/src/AggregatorRunnerFactory.cxx @@ -19,11 +19,11 @@ #include #include -#include #include #include #include "QualityControl/AggregatorRunner.h" +#include "QualityControl/Aggregator.h" #include "QualityControl/AggregatorRunnerFactory.h" using namespace std; @@ -32,9 +32,10 @@ using namespace o2::framework; namespace o2::quality_control::checker { -DataProcessorSpec AggregatorRunnerFactory::create(AggregatorRunnerConfig arc, std::vector acs) +DataProcessorSpec AggregatorRunnerFactory::create(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) { - AggregatorRunner aggregator{ std::move(arc), std::move(acs) }; + AggregatorRunnerConfig aggConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); + AggregatorRunner aggregator{ aggConfig, infrastructureSpec}; DataProcessorSpec newAggregatorRunner{ aggregator.getDeviceName(), diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index 2043645c31..5909df8e63 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -631,15 +631,7 @@ void InfrastructureGenerator::generateAggregator(WorkflowSpec& workflow, const I return; } - std::vector aggregatorConfigs; - for (const auto& aggregatorSpec : infrastructureSpec.aggregators) { - if (aggregatorSpec.active) { - ILOG(Debug, Devel) << ">> Aggregator name : " << aggregatorSpec.aggregatorName << ENDM; - aggregatorConfigs.emplace_back(Aggregator::extractConfig(infrastructureSpec.common, aggregatorSpec)); - } - } - - DataProcessorSpec spec = AggregatorRunnerFactory::create(AggregatorRunnerFactory::extractConfig(infrastructureSpec.common), aggregatorConfigs); + DataProcessorSpec spec = AggregatorRunnerFactory::create(infrastructureSpec); workflow.emplace_back(spec); } diff --git a/Framework/test/testAggregatorRunner.cxx b/Framework/test/testAggregatorRunner.cxx index d2a4ede706..0f6ea2f589 100644 --- a/Framework/test/testAggregatorRunner.cxx +++ b/Framework/test/testAggregatorRunner.cxx @@ -66,7 +66,9 @@ BOOST_AUTO_TEST_CASE(test_aggregator_runner) { std::string configFilePath = std::string("json://") + getTestDataDirectory() + "testSharedConfig.json"; auto [aggregatorRunnerConfig, aggregatorConfigs] = getAggregatorConfigs(configFilePath); - AggregatorRunner aggregatorRunner{ aggregatorRunnerConfig, aggregatorConfigs }; + auto config = ConfigurationFactory::getConfiguration(configFilePath); + auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(config->getRecursive()); + AggregatorRunner aggregatorRunner{ aggregatorRunnerConfig, infrastructureSpec }; std::unique_ptr store; ConfigParamRegistry cfReg(std::move(store)); From 9439568a8b28b594e9bb369192fc8b6a70f05797 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 15:05:05 +0100 Subject: [PATCH 20/36] AggregatorRunner refresh --- .../include/QualityControl/AggregatorRunner.h | 5 ++ .../QualityControl/AggregatorRunnerConfig.h | 1 + .../QualityControl/CheckRunnerConfig.h | 1 + Framework/src/AggregatorRunner.cxx | 71 +++++++++++++++---- Framework/src/AggregatorRunnerFactory.cxx | 10 ++- Framework/src/CheckRunnerFactory.cxx | 12 +++- Framework/src/TaskRunner.cxx | 10 ++- Framework/test/testAggregatorRunner.cxx | 7 +- Framework/test/testTaskRunner.cxx | 15 ++++ 9 files changed, 110 insertions(+), 22 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 41ff63282c..91377203b9 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -136,7 +136,12 @@ class AggregatorRunner : public framework::Task */ void store(core::QualityObjectsType& qualityObjects); + void refreshConfig(framework::InitContext& iCtx); inline void extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + /** + * Prepare the inputs, remove duplicates + */ + void prepareInputs(); inline void initInfoLogger(framework::InitContext& iCtx); inline void initDatabase(); diff --git a/Framework/include/QualityControl/AggregatorRunnerConfig.h b/Framework/include/QualityControl/AggregatorRunnerConfig.h index 366ec98ca0..e88656e9aa 100644 --- a/Framework/include/QualityControl/AggregatorRunnerConfig.h +++ b/Framework/include/QualityControl/AggregatorRunnerConfig.h @@ -33,6 +33,7 @@ struct AggregatorRunnerConfig { std::string fallbackPeriodName{}; std::string fallbackPassName{}; std::string fallbackProvenance{}; + framework::Options options{}; }; } // namespace o2::quality_control::checker diff --git a/Framework/include/QualityControl/CheckRunnerConfig.h b/Framework/include/QualityControl/CheckRunnerConfig.h index 44b5e3ad15..20bac3c96c 100644 --- a/Framework/include/QualityControl/CheckRunnerConfig.h +++ b/Framework/include/QualityControl/CheckRunnerConfig.h @@ -32,6 +32,7 @@ struct CheckRunnerConfig { std::string fallbackPeriodName{}; std::string fallbackPassName{}; std::string fallbackProvenance{}; + framework::Options options{}; }; } // namespace o2::quality_control::checker diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 955f946e34..c08b2e1e09 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -25,12 +25,17 @@ #include #include + +#include + // QC #include "QualityControl/DatabaseFactory.h" #include "QualityControl/QcInfoLogger.h" #include "QualityControl/ServiceDiscovery.h" #include "QualityControl/Aggregator.h" #include "QualityControl/runnerUtils.h" +#include "QualityControl/InfrastructureSpecReader.h" +#include "QualityControl/AggregatorRunnerFactory.h" using namespace AliceO2::Common; using namespace AliceO2::InfoLogger; @@ -54,8 +59,57 @@ AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality mTotalNumberObjectsProduced(0) { extractConfigs(infrastructureSpec); - - // Prepare the inputs, remove duplicates + prepareInputs(); +} + +AggregatorRunner::~AggregatorRunner() +{ + if (mServiceDiscovery != nullptr) { + mServiceDiscovery->deregister(); + } +} + +void AggregatorRunner::refreshConfig(InitContext& iCtx) +{ + cout << "refreshConfig" << endl; + + try { + bool x = iCtx.options().isSet("qcConfiguration"); + auto updatedTree = iCtx.options().get("qcConfiguration"); + + if(updatedTree.empty()) { + cout << "test" << endl; + 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); + + // replace the runner config + mRunnerConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); + + // replace the aggregators configs + mAggregatorsConfigs.clear(); + extractConfigs(infrastructureSpec); + + // replace the inputs + mInputs.clear(); + prepareInputs(); + + 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; + } +} + +void AggregatorRunner::prepareInputs() +{ std::set alreadySeen; int i = 0; for (const auto& aggConfig : mAggregatorsConfigs) { @@ -69,13 +123,6 @@ AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality } } -AggregatorRunner::~AggregatorRunner() -{ - if (mServiceDiscovery != nullptr) { - mServiceDiscovery->deregister(); - } -} - void AggregatorRunner::extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) { for (const auto& aggregatorSpec : infrastructureSpec.aggregators) { @@ -105,9 +152,8 @@ void AggregatorRunner::init(framework::InitContext& iCtx) { initInfoLogger(iCtx); - // refresh - // reset mAggregatorsConfigs - // extractConfigs + refreshConfig(iCtx); + QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); try { initDatabase(); @@ -264,7 +310,6 @@ void AggregatorRunner::initInfoLogger(InitContext& iCtx) ILOG(Error) << "Could not find the DPL InfoLogger." << ENDM; } QcInfoLogger::init("aggregator", mRunnerConfig.infologgerFilterDiscardDebug, mRunnerConfig.infologgerDiscardLevel, il, ilContext); - QcInfoLogger::setDetector(AggregatorRunner::getDetectorName(mAggregators)); } bool AggregatorRunner::areSourcesIn(const std::vector& sources, diff --git a/Framework/src/AggregatorRunnerFactory.cxx b/Framework/src/AggregatorRunnerFactory.cxx index 51ba8ce923..9784db8bd2 100644 --- a/Framework/src/AggregatorRunnerFactory.cxx +++ b/Framework/src/AggregatorRunnerFactory.cxx @@ -42,7 +42,7 @@ DataProcessorSpec AggregatorRunnerFactory::create(const o2::quality_control::cor aggregator.getInputs(), Outputs{}, AlgorithmSpec{}, - Options{} + aggConfig.options }; newAggregatorRunner.labels.emplace_back(o2::framework::ecs::qcReconfigurable); newAggregatorRunner.labels.emplace_back(AggregatorRunner::getLabel()); @@ -63,6 +63,11 @@ void AggregatorRunnerFactory::customizeInfrastructure(std::vector(std::move(qcCheckRunner)); @@ -56,7 +56,7 @@ DataProcessorSpec CheckRunnerFactory::createSinkDevice(CheckRunnerConfig checkRu qcCheckRunner.getInputs(), Outputs{ qcCheckRunner.getOutputs() }, adaptFromTask(std::move(qcCheckRunner)), - Options{}, + checkRunnerConfig.options, {}, std::vector{} }; @@ -76,6 +76,11 @@ void CheckRunnerFactory::customizeInfrastructure(std::vector().set(CallbackService::Id::Start, [this, &services = iCtx.services()]() { start(services); }); - iCtx.services().get().set(CallbackService::Id::Reset, [this]() { reset(); }); - iCtx.services().get().set(CallbackService::Id::Stop, [this]() { stop(); }); + try{ + iCtx.services().get().set(CallbackService::Id::Start, [this, &services = iCtx.services()]() { start(services); }); + iCtx.services().get().set(CallbackService::Id::Reset, [this]() { reset(); }); + iCtx.services().get().set(CallbackService::Id::Stop, [this]() { stop(); }); + } catch (o2::framework::RuntimeErrorRef& ref) { + ILOG(Error) << "Error during initialization: " << o2::framework::error_from_ref(ref).what << ENDM; + } // setup monitoring mCollector = MonitoringFactory::Get(mTaskConfig.monitoringUrl); diff --git a/Framework/test/testAggregatorRunner.cxx b/Framework/test/testAggregatorRunner.cxx index 0f6ea2f589..658fa764ff 100644 --- a/Framework/test/testAggregatorRunner.cxx +++ b/Framework/test/testAggregatorRunner.cxx @@ -70,7 +70,12 @@ BOOST_AUTO_TEST_CASE(test_aggregator_runner) auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(config->getRecursive()); AggregatorRunner aggregatorRunner{ aggregatorRunnerConfig, infrastructureSpec }; - std::unique_ptr store; + Options options{ + { "runNumber", VariantType::String, { "Run number" } }, + {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + }; + std::vector> retr; + std::unique_ptr store = make_unique(move(options), move(retr)); ConfigParamRegistry cfReg(std::move(store)); ServiceRegistry sReg; InitContext initContext{ cfReg, sReg }; diff --git a/Framework/test/testTaskRunner.cxx b/Framework/test/testTaskRunner.cxx index ffb23f61f1..2be98ed508 100644 --- a/Framework/test/testTaskRunner.cxx +++ b/Framework/test/testTaskRunner.cxx @@ -22,6 +22,9 @@ #include "QualityControl/InfrastructureSpecReader.h" #include "Configuration/ConfigurationFactory.h" #include "Configuration/ConfigurationInterface.h" +#include +#include +#include #define BOOST_TEST_MODULE TaskRunner test #define BOOST_TEST_MAIN @@ -101,6 +104,18 @@ BOOST_AUTO_TEST_CASE(test_task_runner) // This is maximum that we can do until we are able to test the DPL algorithms in isolation. // TODO: When it is possible, we should try calling run() and init() + + // Attempt for init: + Options options{ + { "runNumber", VariantType::String, { "Run number" } }, + {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + }; + std::vector> retr; + std::unique_ptr store = make_unique(move(options), move(retr)); + ConfigParamRegistry cfReg(std::move(store)); + ServiceRegistry sReg; + InitContext initContext{ cfReg, sReg }; + qcTask.init(initContext); } BOOST_AUTO_TEST_CASE(test_task_wrong_detector_name) From d68381dc06035057910797b5fb0585d5e0be362a Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Fri, 14 Jan 2022 15:14:32 +0100 Subject: [PATCH 21/36] format --- Framework/include/QualityControl/runnerUtils.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index 324b86bf70..f926fbfb3e 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -122,15 +122,16 @@ inline std::string computeProvenance(const std::string& fallbackProvenance = "") inline std::string indentTree(int level) { std::string s; - for (int i = 0; i Date: Mon, 17 Jan 2022 09:04:49 +0100 Subject: [PATCH 22/36] remove cout --- Framework/src/AggregatorRunner.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index c08b2e1e09..6d62c68557 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -71,14 +71,11 @@ AggregatorRunner::~AggregatorRunner() void AggregatorRunner::refreshConfig(InitContext& iCtx) { - cout << "refreshConfig" << endl; - try { bool x = iCtx.options().isSet("qcConfiguration"); auto updatedTree = iCtx.options().get("qcConfiguration"); if(updatedTree.empty()) { - cout << "test" << endl; 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 From 679a05ed9ca6fbf9f3d338378b53eda37c33a4c4 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 09:07:56 +0100 Subject: [PATCH 23/36] format --- Framework/src/AggregatorRunner.cxx | 9 ++++----- Framework/src/AggregatorRunnerFactory.cxx | 4 ++-- Framework/src/CheckRunner.cxx | 8 ++++---- Framework/src/CheckRunnerFactory.cxx | 2 +- Framework/src/InfrastructureGenerator.cxx | 2 +- Framework/src/TaskRunner.cxx | 18 ++++++++---------- Framework/src/TaskRunnerFactory.cxx | 3 +-- Framework/test/testAggregatorRunner.cxx | 2 +- Framework/test/testTaskRunner.cxx | 2 +- 9 files changed, 23 insertions(+), 27 deletions(-) diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 6d62c68557..889830e2fc 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -75,11 +75,11 @@ void AggregatorRunner::refreshConfig(InitContext& iCtx) bool x = iCtx.options().isSet("qcConfiguration"); auto updatedTree = iCtx.options().get("qcConfiguration"); - if(updatedTree.empty()) { + 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; + 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); } @@ -99,7 +99,7 @@ void AggregatorRunner::refreshConfig(InitContext& iCtx) ILOG(Debug, Devel) << "Configuration refreshed" << ENDM; } - } catch (std::invalid_argument & error) { + } 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; } @@ -398,7 +398,6 @@ void AggregatorRunner::start(const ServiceRegistry& services) << "\n - period: " << mActivity.mPeriodName << "\n - pass type: " << mActivity.mPassName << "\n - provenance: " << mActivity.mProvenance << ENDM; } - void AggregatorRunner::stop() { ILOG(Info, Ops) << "Stopping run " << mActivity.mId << ENDM; diff --git a/Framework/src/AggregatorRunnerFactory.cxx b/Framework/src/AggregatorRunnerFactory.cxx index 9784db8bd2..b7927a52b9 100644 --- a/Framework/src/AggregatorRunnerFactory.cxx +++ b/Framework/src/AggregatorRunnerFactory.cxx @@ -35,7 +35,7 @@ namespace o2::quality_control::checker DataProcessorSpec AggregatorRunnerFactory::create(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) { AggregatorRunnerConfig aggConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); - AggregatorRunner aggregator{ aggConfig, infrastructureSpec}; + AggregatorRunner aggregator{ aggConfig, infrastructureSpec }; DataProcessorSpec newAggregatorRunner{ aggregator.getDeviceName(), @@ -65,7 +65,7 @@ AggregatorRunnerConfig AggregatorRunnerFactory::extractConfig(const core::Common { Options options{ { "runNumber", framework::VariantType::String, { "Run number" } }, - {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + { "qcConfiguration", VariantType::Dict, emptyDict(), { "Some dictionary configuration" } } }; return { diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index b0c2ea8478..77dbaa8f98 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -169,11 +169,11 @@ void CheckRunner::refreshConfig(InitContext& iCtx) // get the tree auto updatedTree = iCtx.options().get("qcConfiguration"); - if(updatedTree.empty()) { + 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; + 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); } @@ -187,7 +187,7 @@ void CheckRunner::refreshConfig(InitContext& iCtx) QcInfoLogger::setDetector(CheckRunner::getDetectorName(mChecks)); } - } catch (std::invalid_argument & error) { + } 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; } diff --git a/Framework/src/CheckRunnerFactory.cxx b/Framework/src/CheckRunnerFactory.cxx index 892710073d..5047e94de7 100644 --- a/Framework/src/CheckRunnerFactory.cxx +++ b/Framework/src/CheckRunnerFactory.cxx @@ -78,7 +78,7 @@ CheckRunnerConfig CheckRunnerFactory::extractConfig(const CommonSpec& commonSpec { Options options{ { "runNumber", framework::VariantType::String, { "Run number" } }, - {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + { "qcConfiguration", VariantType::Dict, emptyDict(), { "Some dictionary configuration" } } }; return { diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index 5909df8e63..6713f74ae9 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -594,7 +594,7 @@ void InfrastructureGenerator::generateCheckRunners(framework::WorkflowSpec& work std::vector checkRunnerOutputs; auto checkRunnerConfig = CheckRunnerFactory::extractConfig(infrastructureSpec.common); for (auto& [inputNames, checkConfigs] : checksMap) { - //Logging + // Logging ILOG(Info, Devel) << ">> Inputs (" << inputNames.size() << "): "; for (const auto& name : inputNames) ILOG(Info, Devel) << name << " "; diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index b1d1ffb9d8..e6ef4fe5ba 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -69,11 +69,11 @@ void TaskRunner::refreshConfig(InitContext& iCtx) // get the tree auto updatedTree = iCtx.options().get("qcConfiguration"); - if(updatedTree.empty()) { + 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; + 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); } @@ -82,16 +82,15 @@ void TaskRunner::refreshConfig(InitContext& iCtx) // find the correct taskSpec auto it = find_if(infrastructureSpec.tasks.begin(), infrastructureSpec.tasks.end(), - [this](const TaskSpec& ts) {return ts.taskName == mTaskConfig.taskName;}); + [this](const TaskSpec& ts) { return ts.taskName == mTaskConfig.taskName; }); if (it != infrastructureSpec.tasks.end()) { - mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); + mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->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; + 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) { + } 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; } @@ -115,7 +114,6 @@ void TaskRunner::initInfologger(InitContext& iCtx) QcInfoLogger::setDetector(mTaskConfig.detectorName); } - void TaskRunner::init(InitContext& iCtx) { initInfologger(iCtx); @@ -125,7 +123,7 @@ void TaskRunner::init(InitContext& iCtx) printTaskConfig(); // registering state machine callbacks - try{ + try { iCtx.services().get().set(CallbackService::Id::Start, [this, &services = iCtx.services()]() { start(services); }); iCtx.services().get().set(CallbackService::Id::Reset, [this]() { reset(); }); iCtx.services().get().set(CallbackService::Id::Stop, [this]() { stop(); }); diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index cfb195ada7..b903d0697a 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -32,7 +32,6 @@ #include #include - namespace o2::quality_control::core { @@ -86,7 +85,7 @@ TaskRunnerConfig TaskRunnerFactory::extractConfig(const CommonSpec& globalConfig Options options{ { "period-timer-cycle", framework::VariantType::Int, static_cast(taskSpec.cycleDurationSeconds * 1000000), { "timer period" } }, { "runNumber", framework::VariantType::String, { "Run number" } }, - {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + { "qcConfiguration", VariantType::Dict, emptyDict(), { "Some dictionary configuration" } } }; return { diff --git a/Framework/test/testAggregatorRunner.cxx b/Framework/test/testAggregatorRunner.cxx index 658fa764ff..c5b57f81d7 100644 --- a/Framework/test/testAggregatorRunner.cxx +++ b/Framework/test/testAggregatorRunner.cxx @@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(test_aggregator_runner) Options options{ { "runNumber", VariantType::String, { "Run number" } }, - {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + { "qcConfiguration", VariantType::Dict, emptyDict(), { "Some dictionary configuration" } } }; std::vector> retr; std::unique_ptr store = make_unique(move(options), move(retr)); diff --git a/Framework/test/testTaskRunner.cxx b/Framework/test/testTaskRunner.cxx index 2be98ed508..4f983ac864 100644 --- a/Framework/test/testTaskRunner.cxx +++ b/Framework/test/testTaskRunner.cxx @@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(test_task_runner) // Attempt for init: Options options{ { "runNumber", VariantType::String, { "Run number" } }, - {"qcConfiguration", VariantType::Dict, emptyDict(), {"Some dictionary configuration"} } + { "qcConfiguration", VariantType::Dict, emptyDict(), { "Some dictionary configuration" } } }; std::vector> retr; std::unique_ptr store = make_unique(move(options), move(retr)); From 6690a55368f8e39d87f30dd2a7d7903b6252ed63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barth=C3=A9l=C3=A9my=20von=20Haller?= Date: Mon, 17 Jan 2022 10:18:12 +0100 Subject: [PATCH 24/36] Update Framework/include/QualityControl/AggregatorRunner.h Co-authored-by: Piotr Konopka --- Framework/include/QualityControl/AggregatorRunner.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 91377203b9..5c9b489a63 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -94,7 +94,7 @@ class AggregatorRunner : public framework::Task * @param arc AggregatorRunner Config * @param acs Aggregator configs */ - AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + AggregatorRunner(AggregatorRunnerConfig arc, const core::InfrastructureSpec& infrastructureSpec); /// Destructor ~AggregatorRunner() override; From 8fb3571ee9ad62d161db41253aa191cb5be7b020 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 10:22:57 +0100 Subject: [PATCH 25/36] remove useless inline --- Framework/include/QualityControl/AggregatorRunner.h | 12 ++++++------ Framework/include/QualityControl/CheckRunner.h | 8 ++++---- Framework/include/QualityControl/TaskRunner.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 5c9b489a63..3b45970604 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -137,17 +137,17 @@ class AggregatorRunner : public framework::Task void store(core::QualityObjectsType& qualityObjects); void refreshConfig(framework::InitContext& iCtx); - inline void extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + void extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); /** * Prepare the inputs, remove duplicates */ void prepareInputs(); - inline void initInfoLogger(framework::InitContext& iCtx); - inline void initDatabase(); - inline void initMonitoring(); - inline void initServiceDiscovery(); - inline void initAggregators(); + void initInfoLogger(framework::InitContext& iCtx); + void initDatabase(); + void initMonitoring(); + void initServiceDiscovery(); + void initAggregators(); /** * Reorder the aggregators stored in mAggregators. diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index e2763d7143..5ebd5362e1 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -164,10 +164,10 @@ class CheckRunner : public framework::Task */ static o2::framework::Outputs collectOutputs(const std::vector& checks); - inline void initDatabase(); - inline void initMonitoring(); - inline void initServiceDiscovery(); - inline void initInfologger(framework::InitContext& iCtx); + void initDatabase(); + void initMonitoring(); + void initServiceDiscovery(); + void initInfologger(framework::InitContext& iCtx); /** * Update the list of objects this TaskRunner is sending out. diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index a00b910a73..6d693244e4 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -113,8 +113,8 @@ class TaskRunner : public framework::Task std::tuple validateInputs(const framework::InputRecord&); void refreshConfig(framework::InitContext& iCtx); - inline void initInfologger(framework::InitContext& iCtx); - inline void printTaskConfig(); + void initInfologger(framework::InitContext& iCtx); + void printTaskConfig(); void startOfActivity(); void endOfActivity(); void startCycle(); From 95e24ba7eff99ead156eb1635bb3db882f76e2b5 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 11:06:35 +0100 Subject: [PATCH 26/36] Pass only what we need and pass config --- .../include/QualityControl/AggregatorRunner.h | 4 +-- .../QualityControl/AggregatorRunnerFactory.h | 7 +++-- Framework/src/AggregatorRunner.cxx | 25 +++++------------ Framework/src/AggregatorRunnerFactory.cxx | 27 +++++++++++++++---- Framework/src/InfrastructureGenerator.cxx | 2 +- Framework/test/testAggregatorRunner.cxx | 6 ++--- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 3b45970604..456943f5a4 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -94,7 +94,7 @@ class AggregatorRunner : public framework::Task * @param arc AggregatorRunner Config * @param acs Aggregator configs */ - AggregatorRunner(AggregatorRunnerConfig arc, const core::InfrastructureSpec& infrastructureSpec); + AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs); /// Destructor ~AggregatorRunner() override; @@ -182,7 +182,7 @@ class AggregatorRunner : public framework::Task std::vector> mAggregators; std::shared_ptr mDatabase; AggregatorRunnerConfig mRunnerConfig; - std::vector mAggregatorsConfigs; + std::vector mAggregatorsConfig; core::QualityObjectsMapType mQualityObjects; // where we cache the incoming quality objects and the output of the aggregators UpdatePolicyManager updatePolicyManager; diff --git a/Framework/include/QualityControl/AggregatorRunnerFactory.h b/Framework/include/QualityControl/AggregatorRunnerFactory.h index 5fe500cb91..322cd4faa3 100644 --- a/Framework/include/QualityControl/AggregatorRunnerFactory.h +++ b/Framework/include/QualityControl/AggregatorRunnerFactory.h @@ -37,10 +37,13 @@ class AggregatorRunnerFactory AggregatorRunnerFactory() = default; virtual ~AggregatorRunnerFactory() = default; - static framework::DataProcessorSpec create(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + static framework::DataProcessorSpec create(const core::CommonSpec& commonSpec, + const std::vector& aggregatorsSpec); static void customizeInfrastructure(std::vector& policies); - static AggregatorRunnerConfig extractConfig(const core::CommonSpec&); + static AggregatorRunnerConfig extractRunnerConfig(const core::CommonSpec&); + static std::vector extractAggregatorsConfig(const core::CommonSpec& commonSpec, + const std::vector& aggregatorsSpec); }; } // namespace o2::quality_control::checker diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 889830e2fc..9fbcc1d2ce 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -51,14 +51,14 @@ const auto current_diagnostic = boost::current_exception_diagnostic_information; namespace o2::quality_control::checker { -AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) +AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs)//, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) : mDeviceName(createAggregatorRunnerName()), mRunnerConfig(std::move(arc)), + mAggregatorsConfig(std::move(acs)), mTotalNumberObjectsReceived(0), mTotalNumberAggregatorExecuted(0), mTotalNumberObjectsProduced(0) { - extractConfigs(infrastructureSpec); prepareInputs(); } @@ -72,7 +72,6 @@ AggregatorRunner::~AggregatorRunner() void AggregatorRunner::refreshConfig(InitContext& iCtx) { try { - bool x = iCtx.options().isSet("qcConfiguration"); auto updatedTree = iCtx.options().get("qcConfiguration"); if (updatedTree.empty()) { @@ -87,11 +86,11 @@ void AggregatorRunner::refreshConfig(InitContext& iCtx) auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); // replace the runner config - mRunnerConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); + mRunnerConfig = AggregatorRunnerFactory::extractRunnerConfig(infrastructureSpec.common); // replace the aggregators configs - mAggregatorsConfigs.clear(); - extractConfigs(infrastructureSpec); + mAggregatorsConfig.clear(); + mAggregatorsConfig = AggregatorRunnerFactory::extractAggregatorsConfig(infrastructureSpec.common, infrastructureSpec.aggregators); // replace the inputs mInputs.clear(); @@ -109,7 +108,7 @@ void AggregatorRunner::prepareInputs() { std::set alreadySeen; int i = 0; - for (const auto& aggConfig : mAggregatorsConfigs) { + for (const auto& aggConfig : mAggregatorsConfig) { for (auto input : aggConfig.inputSpecs) { if (alreadySeen.count(input.binding) == 0) { alreadySeen.insert(input.binding); @@ -120,16 +119,6 @@ void AggregatorRunner::prepareInputs() } } -void AggregatorRunner::extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) -{ - for (const auto& aggregatorSpec : infrastructureSpec.aggregators) { - if (aggregatorSpec.active) { - ILOG(Debug, Devel) << ">> Aggregator name : " << aggregatorSpec.aggregatorName << ENDM; - mAggregatorsConfigs.emplace_back(Aggregator::extractConfig(infrastructureSpec.common, aggregatorSpec)); - } - } -} - header::DataDescription AggregatorRunner::createAggregatorRunnerDataDescription(const std::string& aggregatorName) { if (aggregatorName.empty()) { @@ -274,7 +263,7 @@ void AggregatorRunner::initAggregators() ILOG(Info, Devel) << "Initialization of the aggregators" << ENDM; // For every aggregator definition, create an Aggregator - for (const auto& aggregatorConfig : mAggregatorsConfigs) { + for (const auto& aggregatorConfig : mAggregatorsConfig) { ILOG(Info, Devel) << ">> Aggregator name : " << aggregatorConfig.name << ENDM; try { auto aggregator = make_shared(aggregatorConfig); diff --git a/Framework/src/AggregatorRunnerFactory.cxx b/Framework/src/AggregatorRunnerFactory.cxx index b7927a52b9..9e98a66c2d 100644 --- a/Framework/src/AggregatorRunnerFactory.cxx +++ b/Framework/src/AggregatorRunnerFactory.cxx @@ -25,6 +25,7 @@ #include "QualityControl/AggregatorRunner.h" #include "QualityControl/Aggregator.h" #include "QualityControl/AggregatorRunnerFactory.h" +#include "QualityControl/QcInfoLogger.h" using namespace std; using namespace o2::framework; @@ -32,17 +33,19 @@ using namespace o2::framework; namespace o2::quality_control::checker { -DataProcessorSpec AggregatorRunnerFactory::create(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) +DataProcessorSpec AggregatorRunnerFactory::create(const core::CommonSpec& commonSpec, + const std::vector& aggregatorsSpec) { - AggregatorRunnerConfig aggConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); - AggregatorRunner aggregator{ aggConfig, infrastructureSpec }; + AggregatorRunnerConfig aggRunnerConfig = AggregatorRunnerFactory::extractRunnerConfig(commonSpec); + std::vector aggConfigs = AggregatorRunnerFactory::extractAggregatorsConfig(commonSpec, aggregatorsSpec); + AggregatorRunner aggregator{ aggRunnerConfig, aggConfigs }; DataProcessorSpec newAggregatorRunner{ aggregator.getDeviceName(), aggregator.getInputs(), Outputs{}, AlgorithmSpec{}, - aggConfig.options + aggRunnerConfig.options }; newAggregatorRunner.labels.emplace_back(o2::framework::ecs::qcReconfigurable); newAggregatorRunner.labels.emplace_back(AggregatorRunner::getLabel()); @@ -61,7 +64,7 @@ void AggregatorRunnerFactory::customizeInfrastructure(std::vector AggregatorRunnerFactory::extractAggregatorsConfig( + const core::CommonSpec& commonSpec, + const std::vector& aggregatorsSpec) +{ + std::vector aggConfigs; + for (const auto& aggregatorSpec : aggregatorsSpec) { + if (aggregatorSpec.active) { + ILOG(Debug, Devel) << ">> Aggregator name : " << aggregatorSpec.aggregatorName << ENDM; + aggConfigs.emplace_back(Aggregator::extractConfig(commonSpec, aggregatorSpec)); + } + } + return aggConfigs; +} + } // namespace o2::quality_control::checker diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index 6713f74ae9..c7740f758f 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -631,7 +631,7 @@ void InfrastructureGenerator::generateAggregator(WorkflowSpec& workflow, const I return; } - DataProcessorSpec spec = AggregatorRunnerFactory::create(infrastructureSpec); + DataProcessorSpec spec = AggregatorRunnerFactory::create(infrastructureSpec.common, infrastructureSpec.aggregators); workflow.emplace_back(spec); } diff --git a/Framework/test/testAggregatorRunner.cxx b/Framework/test/testAggregatorRunner.cxx index c5b57f81d7..ecc59ed795 100644 --- a/Framework/test/testAggregatorRunner.cxx +++ b/Framework/test/testAggregatorRunner.cxx @@ -50,7 +50,7 @@ std::pair> getAggregatorCo aggregatorConfigs.emplace_back(Aggregator::extractConfig(infrastructureSpec.common, aggregatorSpec)); } } - auto aggregatorRunnerConfig = AggregatorRunnerFactory::extractConfig(infrastructureSpec.common); + auto aggregatorRunnerConfig = AggregatorRunnerFactory::extractRunnerConfig(infrastructureSpec.common); return { aggregatorRunnerConfig, aggregatorConfigs }; } @@ -66,9 +66,7 @@ BOOST_AUTO_TEST_CASE(test_aggregator_runner) { std::string configFilePath = std::string("json://") + getTestDataDirectory() + "testSharedConfig.json"; auto [aggregatorRunnerConfig, aggregatorConfigs] = getAggregatorConfigs(configFilePath); - auto config = ConfigurationFactory::getConfiguration(configFilePath); - auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(config->getRecursive()); - AggregatorRunner aggregatorRunner{ aggregatorRunnerConfig, infrastructureSpec }; + AggregatorRunner aggregatorRunner{ aggregatorRunnerConfig, aggregatorConfigs }; Options options{ { "runNumber", VariantType::String, { "Run number" } }, From c3268bea81e418614bffbf89851320c7c9af69d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barth=C3=A9l=C3=A9my=20von=20Haller?= Date: Mon, 17 Jan 2022 11:09:23 +0100 Subject: [PATCH 27/36] Update Framework/include/QualityControl/runnerUtils.h Co-authored-by: Piotr Konopka --- Framework/include/QualityControl/runnerUtils.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index f926fbfb3e..91c7ff2109 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -121,10 +121,7 @@ inline std::string computeProvenance(const std::string& fallbackProvenance = "") inline std::string indentTree(int level) { - std::string s; - for (int i = 0; i < level; i++) - s += " "; - return s; + return std::string(level * 2, ' '); } inline void printTree(boost::property_tree::ptree& pt, int level = 0) From 7a11774ddbd6161f421fd14058ebd78cffabce64 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 11:09:32 +0100 Subject: [PATCH 28/36] proper label method names --- Framework/include/QualityControl/CheckRunner.h | 2 +- Framework/include/QualityControl/TaskRunner.h | 2 +- Framework/src/CheckRunnerFactory.cxx | 4 ++-- Framework/src/TaskRunnerFactory.cxx | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Framework/include/QualityControl/CheckRunner.h b/Framework/include/QualityControl/CheckRunner.h index 5ebd5362e1..f687b75e8a 100644 --- a/Framework/include/QualityControl/CheckRunner.h +++ b/Framework/include/QualityControl/CheckRunner.h @@ -114,7 +114,7 @@ class CheckRunner : public framework::Task void setTaskStoreSet(std::unordered_set storeSet) { mInputStoreSet = storeSet; } std::string getDeviceName() { return mDeviceName; }; - static framework::DataProcessorLabel getCheckLabel() { return { "qc-check-runner" }; } + static framework::DataProcessorLabel getCheckRunnerLabel() { return { "qc-check-runner" }; } static std::string createCheckRunnerIdString() { return "QC-CHECK-RUNNER"; }; static std::string createCheckRunnerName(const std::vector& checks); static std::string createSinkCheckRunnerName(o2::framework::InputSpec input); diff --git a/Framework/include/QualityControl/TaskRunner.h b/Framework/include/QualityControl/TaskRunner.h index 6d693244e4..0011c37900 100644 --- a/Framework/include/QualityControl/TaskRunner.h +++ b/Framework/include/QualityControl/TaskRunner.h @@ -90,7 +90,7 @@ class TaskRunner : public framework::Task const framework::Options& getOptions() const { return mTaskConfig.options; }; /// \brief Data Processor Label to identify all Task Runners - static framework::DataProcessorLabel getTaskLabel() { return { "qc-task-runner" }; } + static framework::DataProcessorLabel getTaskRunnerLabel() { return { "qc-task-runner" }; } /// \brief ID string for all TaskRunner devices static std::string createTaskRunnerIdString(); /// \brief Unified DataOrigin for Quality Control tasks diff --git a/Framework/src/CheckRunnerFactory.cxx b/Framework/src/CheckRunnerFactory.cxx index 5047e94de7..9cfbfaf76b 100644 --- a/Framework/src/CheckRunnerFactory.cxx +++ b/Framework/src/CheckRunnerFactory.cxx @@ -42,7 +42,7 @@ DataProcessorSpec CheckRunnerFactory::create(CheckRunnerConfig checkRunnerConfig AlgorithmSpec{}, checkRunnerConfig.options }; newCheckRunner.labels.emplace_back(o2::framework::ecs::qcReconfigurable); - newCheckRunner.labels.emplace_back(CheckRunner::getCheckLabel()); + newCheckRunner.labels.emplace_back(CheckRunner::getCheckRunnerLabel()); newCheckRunner.algorithm = adaptFromTask(std::move(qcCheckRunner)); return newCheckRunner; } @@ -65,7 +65,7 @@ DataProcessorSpec CheckRunnerFactory::createSinkDevice(CheckRunnerConfig checkRu void CheckRunnerFactory::customizeInfrastructure(std::vector& policies) { - auto matcher = [label = CheckRunner::getCheckLabel()](framework::DeviceSpec const& device) { + auto matcher = [label = CheckRunner::getCheckRunnerLabel()](framework::DeviceSpec const& device) { return std::find(device.labels.begin(), device.labels.end(), label) != device.labels.end(); }; diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index b903d0697a..50d4a8e5ec 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -49,7 +49,7 @@ o2::framework::DataProcessorSpec TaskRunnerFactory::create(const TaskRunnerConfi taskConfig.options }; newTask.labels.emplace_back(o2::framework::ecs::qcReconfigurable); - newTask.labels.emplace_back(TaskRunner::getTaskLabel()); + newTask.labels.emplace_back(TaskRunner::getTaskRunnerLabel()); return newTask; } @@ -118,7 +118,7 @@ TaskRunnerConfig TaskRunnerFactory::extractConfig(const CommonSpec& globalConfig void TaskRunnerFactory::customizeInfrastructure(std::vector& policies) { - auto matcher = [label = TaskRunner::getTaskLabel()](framework::DeviceSpec const& device) { + auto matcher = [label = TaskRunner::getTaskRunnerLabel()](framework::DeviceSpec const& device) { return std::find(device.labels.begin(), device.labels.end(), label) != device.labels.end(); }; auto callback = TaskRunner::completionPolicyCallback; From 1159a856a9cca46f2bacccac8d70b42a774b661d Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 11:30:13 +0100 Subject: [PATCH 29/36] Better printing of ptree --- .../include/QualityControl/runnerUtils.h | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index 91c7ff2109..ef673bf436 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -24,6 +24,7 @@ #include #include #include +#include namespace o2::quality_control::core { @@ -124,33 +125,12 @@ inline std::string indentTree(int level) return std::string(level * 2, ' '); } -inline void printTree(boost::property_tree::ptree& pt, int level = 0) +inline void printTree(const boost::property_tree::ptree& pt, int level = 0) { - if (pt.empty()) { - - ILOG(Debug, Devel) << "\"" << pt.data() << "\""; - } else { - if (level) { - ILOG(Debug, Devel) << ENDM; - } - - ILOG(Debug, Devel) << indentTree(level) << "{" << ENDM; - - for (boost::property_tree::ptree::iterator pos = pt.begin(); pos != pt.end();) { - ILOG(Debug, Devel) << indentTree(level + 1) << "\"" << pos->first << "\": "; - - printTree(pos->second, level + 1); - ++pos; - if (pos != pt.end()) { - ILOG(Debug, Devel) << ","; - } - ILOG(Debug, Devel) << ENDM; - } - - ILOG(Debug, Devel) << indentTree(level) << " }"; - } - ILOG(Debug, Devel) << ENDM; - return; + std::stringstream ss; + boost::property_tree::json_parser::write_json(ss, pt); + for (std::string line; std::getline(ss, line, '\n');) + ILOG(Debug, Trace) << line << ENDM; } } // namespace o2::quality_control::core From fdf8889456c753714308385248925132faf95812 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 11:40:43 +0100 Subject: [PATCH 30/36] remove unused headers --- Framework/include/QualityControl/AggregatorRunner.h | 1 - Framework/include/QualityControl/AggregatorRunnerFactory.h | 1 - Framework/src/TaskRunnerFactory.cxx | 3 --- 3 files changed, 5 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index 456943f5a4..fa387f61e0 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -27,7 +27,6 @@ #include "QualityControl/Activity.h" #include "QualityControl/AggregatorRunnerConfig.h" #include "QualityControl/AggregatorConfig.h" -#include "QualityControl/InfrastructureSpec.h" namespace o2::framework { diff --git a/Framework/include/QualityControl/AggregatorRunnerFactory.h b/Framework/include/QualityControl/AggregatorRunnerFactory.h index 322cd4faa3..6c2a7a9c90 100644 --- a/Framework/include/QualityControl/AggregatorRunnerFactory.h +++ b/Framework/include/QualityControl/AggregatorRunnerFactory.h @@ -23,7 +23,6 @@ #include "QualityControl/CommonSpec.h" #include "QualityControl/AggregatorRunnerConfig.h" #include "QualityControl/AggregatorConfig.h" -#include "QualityControl/InfrastructureSpec.h" #include diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index 50d4a8e5ec..d998c419d9 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -23,11 +23,8 @@ #include #include #include -#include -#include #include #include -#include #include #include #include From ea25cf6f8d025fa7ef417958a6f2ee09947c0eaa Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 15:05:14 +0100 Subject: [PATCH 31/36] Fix issue iwth resetAfterCycles --- Framework/include/QualityControl/AggregatorRunner.h | 2 +- Framework/include/QualityControl/AggregatorRunnerFactory.h | 5 +++-- Framework/include/QualityControl/TaskRunnerFactory.h | 3 +++ Framework/src/InfrastructureGenerator.cxx | 3 ++- Framework/src/TaskRunner.cxx | 7 ++++--- Framework/src/TaskRunnerFactory.cxx | 5 +++++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index fa387f61e0..cb492c9b8e 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -136,7 +136,7 @@ class AggregatorRunner : public framework::Task void store(core::QualityObjectsType& qualityObjects); void refreshConfig(framework::InitContext& iCtx); - void extractConfigs(const o2::quality_control::core::InfrastructureSpec& infrastructureSpec); + /** * Prepare the inputs, remove duplicates */ diff --git a/Framework/include/QualityControl/AggregatorRunnerFactory.h b/Framework/include/QualityControl/AggregatorRunnerFactory.h index 6c2a7a9c90..e435bc6c56 100644 --- a/Framework/include/QualityControl/AggregatorRunnerFactory.h +++ b/Framework/include/QualityControl/AggregatorRunnerFactory.h @@ -23,6 +23,7 @@ #include "QualityControl/CommonSpec.h" #include "QualityControl/AggregatorRunnerConfig.h" #include "QualityControl/AggregatorConfig.h" +#include "QualityControl/AggregatorSpec.h" #include @@ -37,12 +38,12 @@ class AggregatorRunnerFactory virtual ~AggregatorRunnerFactory() = default; static framework::DataProcessorSpec create(const core::CommonSpec& commonSpec, - const std::vector& aggregatorsSpec); + const std::vector& aggregatorsSpec); static void customizeInfrastructure(std::vector& policies); static AggregatorRunnerConfig extractRunnerConfig(const core::CommonSpec&); static std::vector extractAggregatorsConfig(const core::CommonSpec& commonSpec, - const std::vector& aggregatorsSpec); + const std::vector& aggregatorsSpec); }; } // namespace o2::quality_control::checker diff --git a/Framework/include/QualityControl/TaskRunnerFactory.h b/Framework/include/QualityControl/TaskRunnerFactory.h index 95be54833d..2285744d4b 100644 --- a/Framework/include/QualityControl/TaskRunnerFactory.h +++ b/Framework/include/QualityControl/TaskRunnerFactory.h @@ -49,6 +49,9 @@ class TaskRunnerFactory /// \brief Knows how to create TaskConfig from Specs static TaskRunnerConfig extractConfig(const CommonSpec&, const TaskSpec&, std::optional id = std::nullopt, std::optional resetAfterCycles = std::nullopt); + + static bool computeResetAfterCycles(const TaskSpec& taskSpec); + /// \brief Provides necessary customization of the TaskRunners. /// /// Provides necessary customization of the Completion Policies of the TaskRunners. This is necessary to make diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index c7740f758f..a616cad986 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -103,6 +103,8 @@ void InfrastructureGenerator::generateStandaloneInfrastructure(framework::Workfl workflow.insert(std::end(workflow), std::begin(qcInfrastructure), std::end(qcInfrastructure)); } + + WorkflowSpec InfrastructureGenerator::generateLocalInfrastructure(const boost::property_tree::ptree& configurationTree, std::string targetHost) { printVersion(); @@ -133,7 +135,6 @@ WorkflowSpec InfrastructureGenerator::generateLocalInfrastructure(const boost::p if (machine == targetHost) { // If we use delta mergers, then the moving window is implemented by the last Merger layer. // The QC Tasks should always send a delta covering one cycle. - int resetAfterCycles = taskSpec.mergingMode == "delta" ? 1 : (int)taskSpec.resetAfterCycles; auto taskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, taskSpec, id, resetAfterCycles); // Generate QC Task Runner workflow.emplace_back(TaskRunnerFactory::create(taskConfig)); diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index e6ef4fe5ba..5edc105eb8 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -80,11 +80,12 @@ void TaskRunner::refreshConfig(InitContext& iCtx) // prepare the information we need auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); // find the correct taskSpec - auto it = find_if(infrastructureSpec.tasks.begin(), + auto taskSpecIter = find_if(infrastructureSpec.tasks.begin(), infrastructureSpec.tasks.end(), [this](const TaskSpec& ts) { return ts.taskName == mTaskConfig.taskName; }); - if (it != infrastructureSpec.tasks.end()) { - mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *it, mTaskConfig.parallelTaskID, it->resetAfterCycles); + if (taskSpecIter != infrastructureSpec.tasks.end()) { + int resetAfterCycles = TaskRunnerFactory::computeResetAfterCycles(*taskSpecIter); + 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; diff --git a/Framework/src/TaskRunnerFactory.cxx b/Framework/src/TaskRunnerFactory.cxx index d998c419d9..d1d70dc932 100644 --- a/Framework/src/TaskRunnerFactory.cxx +++ b/Framework/src/TaskRunnerFactory.cxx @@ -124,4 +124,9 @@ void TaskRunnerFactory::customizeInfrastructure(std::vector Date: Mon, 17 Jan 2022 15:06:34 +0100 Subject: [PATCH 32/36] format --- Framework/include/QualityControl/AggregatorRunnerFactory.h | 2 +- Framework/include/QualityControl/TaskRunnerFactory.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Framework/include/QualityControl/AggregatorRunnerFactory.h b/Framework/include/QualityControl/AggregatorRunnerFactory.h index e435bc6c56..b1e3ec9466 100644 --- a/Framework/include/QualityControl/AggregatorRunnerFactory.h +++ b/Framework/include/QualityControl/AggregatorRunnerFactory.h @@ -43,7 +43,7 @@ class AggregatorRunnerFactory static AggregatorRunnerConfig extractRunnerConfig(const core::CommonSpec&); static std::vector extractAggregatorsConfig(const core::CommonSpec& commonSpec, - const std::vector& aggregatorsSpec); + const std::vector& aggregatorsSpec); }; } // namespace o2::quality_control::checker diff --git a/Framework/include/QualityControl/TaskRunnerFactory.h b/Framework/include/QualityControl/TaskRunnerFactory.h index 2285744d4b..7d7caaa5f2 100644 --- a/Framework/include/QualityControl/TaskRunnerFactory.h +++ b/Framework/include/QualityControl/TaskRunnerFactory.h @@ -49,7 +49,6 @@ class TaskRunnerFactory /// \brief Knows how to create TaskConfig from Specs static TaskRunnerConfig extractConfig(const CommonSpec&, const TaskSpec&, std::optional id = std::nullopt, std::optional resetAfterCycles = std::nullopt); - static bool computeResetAfterCycles(const TaskSpec& taskSpec); /// \brief Provides necessary customization of the TaskRunners. From dda49c188f9f10c4a7f1b22abd0e1cc8e3e8ff54 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 17 Jan 2022 15:10:10 +0100 Subject: [PATCH 33/36] format --- Framework/src/AggregatorRunner.cxx | 2 +- Framework/src/InfrastructureGenerator.cxx | 2 -- Framework/src/TaskRunner.cxx | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Framework/src/AggregatorRunner.cxx b/Framework/src/AggregatorRunner.cxx index 9fbcc1d2ce..eb40c938d5 100644 --- a/Framework/src/AggregatorRunner.cxx +++ b/Framework/src/AggregatorRunner.cxx @@ -51,7 +51,7 @@ const auto current_diagnostic = boost::current_exception_diagnostic_information; namespace o2::quality_control::checker { -AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs)//, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) +AggregatorRunner::AggregatorRunner(AggregatorRunnerConfig arc, const std::vector& acs) //, const o2::quality_control::core::InfrastructureSpec& infrastructureSpec) : mDeviceName(createAggregatorRunnerName()), mRunnerConfig(std::move(arc)), mAggregatorsConfig(std::move(acs)), diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index a616cad986..2df3f3424f 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -103,8 +103,6 @@ void InfrastructureGenerator::generateStandaloneInfrastructure(framework::Workfl workflow.insert(std::end(workflow), std::begin(qcInfrastructure), std::end(qcInfrastructure)); } - - WorkflowSpec InfrastructureGenerator::generateLocalInfrastructure(const boost::property_tree::ptree& configurationTree, std::string targetHost) { printVersion(); diff --git a/Framework/src/TaskRunner.cxx b/Framework/src/TaskRunner.cxx index 5edc105eb8..56d6b8a1a2 100644 --- a/Framework/src/TaskRunner.cxx +++ b/Framework/src/TaskRunner.cxx @@ -81,8 +81,8 @@ void TaskRunner::refreshConfig(InitContext& iCtx) auto infrastructureSpec = InfrastructureSpecReader::readInfrastructureSpec(updatedTree); // find the correct taskSpec auto taskSpecIter = find_if(infrastructureSpec.tasks.begin(), - infrastructureSpec.tasks.end(), - [this](const TaskSpec& ts) { return ts.taskName == mTaskConfig.taskName; }); + infrastructureSpec.tasks.end(), + [this](const TaskSpec& ts) { return ts.taskName == mTaskConfig.taskName; }); if (taskSpecIter != infrastructureSpec.tasks.end()) { int resetAfterCycles = TaskRunnerFactory::computeResetAfterCycles(*taskSpecIter); mTaskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, *taskSpecIter, mTaskConfig.parallelTaskID, resetAfterCycles); From a61ec097e4a55624297d7167ffef527c092784d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barth=C3=A9l=C3=A9my=20von=20Haller?= Date: Tue, 18 Jan 2022 09:30:08 +0100 Subject: [PATCH 34/36] trigger rebuild --- Framework/include/QualityControl/AggregatorRunner.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/include/QualityControl/AggregatorRunner.h b/Framework/include/QualityControl/AggregatorRunner.h index cb492c9b8e..3c59c86be9 100644 --- a/Framework/include/QualityControl/AggregatorRunner.h +++ b/Framework/include/QualityControl/AggregatorRunner.h @@ -138,7 +138,7 @@ class AggregatorRunner : public framework::Task void refreshConfig(framework::InitContext& iCtx); /** - * Prepare the inputs, remove duplicates + * Prepare the inputs, remove the duplicates */ void prepareInputs(); From 71fd3f49148edf15c90753960dcdd143c179311c Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Tue, 18 Jan 2022 14:55:47 +0100 Subject: [PATCH 35/36] fix --- Framework/src/InfrastructureGenerator.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Framework/src/InfrastructureGenerator.cxx b/Framework/src/InfrastructureGenerator.cxx index 2df3f3424f..dcaeff4dd1 100644 --- a/Framework/src/InfrastructureGenerator.cxx +++ b/Framework/src/InfrastructureGenerator.cxx @@ -133,7 +133,7 @@ WorkflowSpec InfrastructureGenerator::generateLocalInfrastructure(const boost::p if (machine == targetHost) { // If we use delta mergers, then the moving window is implemented by the last Merger layer. // The QC Tasks should always send a delta covering one cycle. - auto taskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, taskSpec, id, resetAfterCycles); + auto taskConfig = TaskRunnerFactory::extractConfig(infrastructureSpec.common, taskSpec, id, TaskRunnerFactory::computeResetAfterCycles(taskSpec)); // Generate QC Task Runner workflow.emplace_back(TaskRunnerFactory::create(taskConfig)); // Generate an output proxy From 00eac9dff7acccfdccfd3048265a02692f0d7ba7 Mon Sep 17 00:00:00 2001 From: Barthelemy Date: Mon, 24 Jan 2022 10:31:03 +0100 Subject: [PATCH 36/36] fix --- Framework/src/CheckRunner.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Framework/src/CheckRunner.cxx b/Framework/src/CheckRunner.cxx index 5c589dced4..5c02fa6cb9 100644 --- a/Framework/src/CheckRunner.cxx +++ b/Framework/src/CheckRunner.cxx @@ -185,8 +185,7 @@ void CheckRunner::refreshConfig(InitContext& iCtx) // TODO: in particular, reset mChecks and update it. // TODO: Problem is that a lot of the logic is in the infrastructure generator. // TODO: we should probably just preserve the checks list and update their state. - - mDetectorName = CheckRunner::getDetectorName(mChecks); + // TODO: also see if we should update the detector name } } 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 @@ -199,7 +198,6 @@ void CheckRunner::init(framework::InitContext& iCtx) try { initInfologger(iCtx); refreshConfig(iCtx); - QcInfoLogger::setDetector(mDetectorName); initDatabase(); initMonitoring(); initServiceDiscovery();