From 94e4dd656f7b339c020ef8ad9e86ead3338724e6 Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Wed, 7 Feb 2018 20:58:00 +0100 Subject: [PATCH 1/4] bring back Configuration to life --- Framework/include/QualityControl/Checker.h | 1 - Framework/include/QualityControl/TaskDevice.h | 1 - Framework/src/SpyMainFrame.cxx | 1 - cmake/FindConfiguration.cmake | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Framework/include/QualityControl/Checker.h b/Framework/include/QualityControl/Checker.h index f02493f3ae..144f0b6eb0 100644 --- a/Framework/include/QualityControl/Checker.h +++ b/Framework/include/QualityControl/Checker.h @@ -16,7 +16,6 @@ #include // O2 #include -#include #include #include #include diff --git a/Framework/include/QualityControl/TaskDevice.h b/Framework/include/QualityControl/TaskDevice.h index e59d6a0172..52efbdf8aa 100644 --- a/Framework/include/QualityControl/TaskDevice.h +++ b/Framework/include/QualityControl/TaskDevice.h @@ -14,7 +14,6 @@ #include // O2 #include -#include #include #include #include diff --git a/Framework/src/SpyMainFrame.cxx b/Framework/src/SpyMainFrame.cxx index 403353e9da..8aa9eb010d 100644 --- a/Framework/src/SpyMainFrame.cxx +++ b/Framework/src/SpyMainFrame.cxx @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/cmake/FindConfiguration.cmake b/cmake/FindConfiguration.cmake index b6cc5887ea..2748e23801 100644 --- a/cmake/FindConfiguration.cmake +++ b/cmake/FindConfiguration.cmake @@ -14,7 +14,7 @@ include(FindPackageHandleStandardArgs) # find includes -find_path(CONFIGURATION_INCLUDE_DIR Configuration.h +find_path(CONFIGURATION_INCLUDE_DIR ConfigurationInterface.h HINTS ${Configuration_ROOT}/include ENV LD_LIBRARY_PATH PATH_SUFFIXES "../include/Configuration" "../../include/Configuration" ) # Remove the final "Configuration" get_filename_component(CONFIGURATION_INCLUDE_DIR ${CONFIGURATION_INCLUDE_DIR} DIRECTORY) From f0b68e98fb0840b971be57865dbdc3c698c7577d Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Wed, 7 Feb 2018 21:38:53 +0100 Subject: [PATCH 2/4] porting to the new Monitoring API --- Framework/include/QualityControl/Checker.h | 2 +- Framework/include/QualityControl/TaskDevice.h | 2 +- Framework/src/Checker.cxx | 3 ++- Framework/src/TaskDevice.cxx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Framework/include/QualityControl/Checker.h b/Framework/include/QualityControl/Checker.h index 144f0b6eb0..b000cbd724 100644 --- a/Framework/include/QualityControl/Checker.h +++ b/Framework/include/QualityControl/Checker.h @@ -17,7 +17,7 @@ // O2 #include #include -#include +#include #include // QC #include "QualityControl/QcInfoLogger.h" diff --git a/Framework/include/QualityControl/TaskDevice.h b/Framework/include/QualityControl/TaskDevice.h index 52efbdf8aa..60dafa9cdd 100644 --- a/Framework/include/QualityControl/TaskDevice.h +++ b/Framework/include/QualityControl/TaskDevice.h @@ -15,7 +15,7 @@ // O2 #include #include -#include +#include #include // QC #include "QualityControl/TaskConfig.h" diff --git a/Framework/src/Checker.cxx b/Framework/src/Checker.cxx index c60e237583..5e72c01788 100644 --- a/Framework/src/Checker.cxx +++ b/Framework/src/Checker.cxx @@ -37,6 +37,7 @@ using namespace std; using namespace AliceO2::InfoLogger; using namespace std::chrono; using namespace AliceO2::Configuration; +using namespace AliceO2::Monitoring; namespace o2 { namespace quality_control { @@ -66,7 +67,7 @@ Checker::Checker(std::string checkerName, std::string configurationSource) // monitoring try { - mCollector = std::make_shared(configurationSource); + mCollector = MonitoringFactory::Get("infologger://"); mCollector->addDerivedMetric("objects", AliceO2::Monitoring::DerivedMetricMode::RATE); } catch (...) { string diagnostic = boost::current_exception_diagnostic_information(); diff --git a/Framework/src/TaskDevice.cxx b/Framework/src/TaskDevice.cxx index 843d89dc38..b67e268bf3 100644 --- a/Framework/src/TaskDevice.cxx +++ b/Framework/src/TaskDevice.cxx @@ -57,7 +57,7 @@ TaskDevice::TaskDevice(std::string taskName, std::string configurationSource) : populateConfig(mTaskName); // setup monitoring - mCollector = make_unique(configurationSource); + mCollector = MonitoringFactory::Get("infologger://"); // setup publisher mObjectsManager = make_shared(mTaskConfig); From 0af32d9fbbd7d654e4f2d9ea2f7fc0609cb26d49 Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Wed, 7 Feb 2018 21:39:31 +0100 Subject: [PATCH 3/4] migrated from obsolete Configuration API --- Modules/Common/src/MeanIsAbove.cxx | 6 +++--- Modules/Example/include/Example/BenchmarkTask.h | 4 ++-- Modules/Example/src/BenchmarkTask.cxx | 13 +++++++------ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Modules/Common/src/MeanIsAbove.cxx b/Modules/Common/src/MeanIsAbove.cxx index 964236619e..26ae0b65e6 100644 --- a/Modules/Common/src/MeanIsAbove.cxx +++ b/Modules/Common/src/MeanIsAbove.cxx @@ -11,11 +11,12 @@ #include #include // O2 -#include "Configuration/Configuration.h" +#include "Configuration/ConfigurationFactory.h" ClassImp(o2::quality_control_modules::common::MeanIsAbove) using namespace std; +using namespace AliceO2::Configuration; namespace o2 { namespace quality_control_modules { @@ -29,9 +30,8 @@ MeanIsAbove::MeanIsAbove() void MeanIsAbove::configure(std::string name) { // TODO use the configuration system to set the params - AliceO2::Configuration::ConfigFile configFile; try { - configFile.load("file:../example.ini"); // not ok... + auto configFile = ConfigurationFactory::getConfiguration("file:../example.ini"); // not ok... } catch (string &exception) { cout << "error getting config file in MeanIsAbove : " << exception << endl; mThreshold = 1.0f; diff --git a/Modules/Example/include/Example/BenchmarkTask.h b/Modules/Example/include/Example/BenchmarkTask.h index 12c66893b3..41f405588c 100644 --- a/Modules/Example/include/Example/BenchmarkTask.h +++ b/Modules/Example/include/Example/BenchmarkTask.h @@ -9,7 +9,7 @@ #include "QualityControl/TaskInterface.h" #include -#include "Configuration/Configuration.h" +#include "Configuration/ConfigurationFactory.h" class TH1F; @@ -44,7 +44,7 @@ class BenchmarkTask: public TaskInterface private: std::vector mHistos; - AliceO2::Configuration::ConfigFile mConfigFile; + std::unique_ptr mConfigFile; size_t mNumberHistos; size_t mNumberChecks; std::string mTypeOfChecks; diff --git a/Modules/Example/src/BenchmarkTask.cxx b/Modules/Example/src/BenchmarkTask.cxx index e3e39191ca..a4d2faec97 100644 --- a/Modules/Example/src/BenchmarkTask.cxx +++ b/Modules/Example/src/BenchmarkTask.cxx @@ -10,6 +10,7 @@ #include using namespace std; +using namespace AliceO2::Configuration; namespace o2 { namespace quality_control_modules { @@ -29,12 +30,12 @@ void BenchmarkTask::initialize() QcInfoLogger::GetInstance() << "initialize benchmarktask \"" << getName() << "\"" << AliceO2::InfoLogger::InfoLogger::endm; - mConfigFile.load("file:./example.ini"); - string taskDefinitionName = mConfigFile.getValue(getName() + ".taskDefinition"); - mNumberHistos = mConfigFile.getValue(taskDefinitionName + ".numberHistos"); - mNumberChecks = mConfigFile.getValue(taskDefinitionName + ".numberChecks"); - mTypeOfChecks = mConfigFile.getValue(taskDefinitionName + ".typeOfChecks"); - mModuleOfChecks = mConfigFile.getValue(taskDefinitionName + ".moduleOfChecks"); + mConfigFile = ConfigurationFactory::getConfiguration("file:./example.ini"); + string taskDefinitionName = mConfigFile->get(getName() + ".taskDefinition").value(); + mNumberHistos = mConfigFile->get(taskDefinitionName + ".numberHistos").value(); + mNumberChecks = mConfigFile->get(taskDefinitionName + ".numberChecks").value(); + mTypeOfChecks = mConfigFile->get(taskDefinitionName + ".typeOfChecks").value(); + mModuleOfChecks = mConfigFile->get(taskDefinitionName + ".moduleOfChecks").value(); mHistos.reserve(mNumberHistos); From cf2b391c135d2565d77607d19f831f52ae4e4bba Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Thu, 8 Feb 2018 08:54:13 +0100 Subject: [PATCH 4/4] remove unecessary include --- Framework/include/QualityControl/Checker.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Framework/include/QualityControl/Checker.h b/Framework/include/QualityControl/Checker.h index b000cbd724..f9a72ffb8c 100644 --- a/Framework/include/QualityControl/Checker.h +++ b/Framework/include/QualityControl/Checker.h @@ -18,7 +18,6 @@ #include #include #include -#include // QC #include "QualityControl/QcInfoLogger.h" #include "QualityControl/CheckInterface.h"