Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Framework/include/QualityControl/Aggregator.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Aggregator
bool getAllObjectsOption() const;
std::vector<AggregatorSource> getSources();
std::vector<AggregatorSource> getSources(core::DataSourceType type);
const std::string& getDetector() const { return mAggregatorConfig.detectorName; };

static AggregatorConfig extractConfig(const core::CommonSpec&, const AggregatorSpec&);

Expand Down
5 changes: 5 additions & 0 deletions Framework/include/QualityControl/AggregatorRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ class AggregatorRunner : public framework::Task
static std::string createAggregatorRunnerName();
static header::DataDescription createAggregatorRunnerDataDescription(const std::string& aggregatorName);

/// \brief Compute the detector name to be used in the infologger for this runner.
/// Compute the detector name to be used in the infologger for this runner.
/// If all checks belong to the same detector we use it, otherwise we use "MANY"
static std::string getDetectorName(std::vector<std::shared_ptr<Aggregator>> aggregators);

private:
/**
* \brief For each aggregator, check if the data is ready and, if so, call its own aggregation method.
Expand Down
1 change: 1 addition & 0 deletions Framework/include/QualityControl/Check.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class Check
const std::string& getName() const { return mCheckConfig.name; };
o2::framework::OutputSpec getOutputSpec() const { return mCheckConfig.qoSpec; };
o2::framework::Inputs getInputs() const { return mCheckConfig.inputSpecs; };
const std::string& getDetector() const { return mCheckConfig.detectorName; };

//TODO: Unique Input string
static o2::header::DataDescription createCheckDataDescription(const std::string& checkName);
Expand Down
5 changes: 5 additions & 0 deletions Framework/include/QualityControl/CheckRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ class CheckRunner : public framework::Task
static std::string createSinkCheckRunnerName(o2::framework::InputSpec input);
static std::string createCheckRunnerFacility(std::string deviceName);

/// \brief Compute the detector name to be used in the infologger for this checkrunner.
/// Compute the detector name to be used in the infologger for this checkrunner.
/// If all checks belong to the same detector we use it, otherwise we use "MANY"
static std::string getDetectorName(std::vector<Check> checks);

private:
/**
* \brief Evaluate the quality of a MonitorObject.
Expand Down
16 changes: 16 additions & 0 deletions Framework/src/AggregatorRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ void AggregatorRunner::init(framework::InitContext& iCtx)

try {
ILOG_INST.init("aggregator", mRunnerConfig.infologgerFilterDiscardDebug, mRunnerConfig.infologgerDiscardLevel, ilContext);
ILOG_INST.setDetector(AggregatorRunner::getDetectorName(mAggregators));
initDatabase();
initMonitoring();
initServiceDiscovery();
Expand Down Expand Up @@ -343,4 +344,19 @@ void AggregatorRunner::reset()
}
}

std::string AggregatorRunner::getDetectorName(std::vector<std::shared_ptr<Aggregator>> aggregators)
{
std::string detectorName;
for (auto& aggregator : aggregators) {
const std::string& thisDetector = aggregator->getDetector();
if (detectorName.length() == 0) {
detectorName = thisDetector;
} else if (thisDetector != detectorName) {
detectorName = "MANY";
break;
}
}
return detectorName;
}

} // namespace o2::quality_control::checker
16 changes: 16 additions & 0 deletions Framework/src/CheckRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ void CheckRunner::init(framework::InitContext& iCtx)
mConfig.infologgerFilterDiscardDebug,
mConfig.infologgerDiscardLevel,
ilContext);
ILOG_INST.setDetector(CheckRunner::getDetectorName(mChecks));
initDatabase();
initMonitoring();
initServiceDiscovery();
Expand Down Expand Up @@ -454,4 +455,19 @@ void CheckRunner::reset()
mTotalQOSent = 0;
}

std::string CheckRunner::getDetectorName(std::vector<Check> checks)
{
std::string detectorName;
for (auto& check : checks) {
const std::string& thisDetector = check.getDetector();
if (detectorName.length() == 0) {
detectorName = thisDetector;
} else if (thisDetector != detectorName) {
detectorName = "MANY";
break;
}
}
return detectorName;
}

} // namespace o2::quality_control::checker
19 changes: 19 additions & 0 deletions Framework/test/testAggregatorRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,23 @@ BOOST_AUTO_TEST_CASE(test_aggregator_quality_filter)
qoMap["dataSizeCheck2/someNumbersTask/example2"] = make_shared<QualityObject>(Quality::Bad, "dataSizeCheck2/someNumbersTask/example2");
result = aggregator->aggregate(qoMap);
BOOST_CHECK_EQUAL(getQualityForCheck(result, "MyAggregatorB/newQuality"), Quality::Medium);
}

BOOST_AUTO_TEST_CASE(test_getDetector)
{
AggregatorConfig config;
config.detectorName = "TST";

std::vector<std::shared_ptr<Aggregator>> aggregators;
BOOST_CHECK_EQUAL(AggregatorRunner::getDetectorName(aggregators), "");
auto checkTST = std::make_shared<Aggregator>(config);
aggregators.push_back(checkTST);
BOOST_CHECK_EQUAL(AggregatorRunner::getDetectorName(aggregators), "TST");
auto checkTST2 = std::make_shared<Aggregator>(config);
aggregators.push_back(checkTST2);
BOOST_CHECK_EQUAL(AggregatorRunner::getDetectorName(aggregators), "TST");
config.detectorName = "EMC";
auto checkEMC = std::make_shared<Aggregator>(config);
aggregators.push_back(checkEMC);
BOOST_CHECK_EQUAL(AggregatorRunner::getDetectorName(aggregators), "MANY");
}
18 changes: 18 additions & 0 deletions Framework/test/testCheckRunner.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,21 @@ BOOST_AUTO_TEST_CASE(test_check_runner_static)
BOOST_CHECK(CheckRunner::createCheckRunnerFacility(CheckRunner::createCheckRunnerIdString() + "-abcdefghijklmnopqrstuvwxyz") == "check/abcdefghijklmnopqrstuvwxyz");
BOOST_CHECK(CheckRunner::createCheckRunnerFacility(CheckRunner::createCheckRunnerIdString() + "-abcdefghijklmnopqrstuvwxyz123456789") == "check/abcdefghijklmnopqrstuvwxyz");
}

BOOST_AUTO_TEST_CASE(test_getDetector)
{
CheckConfig config;
config.detectorName = "TST";

vector<Check> checks;
BOOST_CHECK_EQUAL(CheckRunner::getDetectorName(checks), "");
Check checkTST(config);
checks.push_back(checkTST);
BOOST_CHECK_EQUAL(CheckRunner::getDetectorName(checks), "TST");
checks.push_back(checkTST);
BOOST_CHECK_EQUAL(CheckRunner::getDetectorName(checks), "TST");
config.detectorName = "EMC";
Check checkEMC(config);
checks.push_back(checkEMC);
BOOST_CHECK_EQUAL(CheckRunner::getDetectorName(checks), "MANY");
}