Skip to content

[QC-1031]: changed origin for QC Check #2170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.cproject
.project
.vscode
.cache
*~
.idea
*.jpg
Expand Down
4 changes: 2 additions & 2 deletions Framework/include/QualityControl/Check.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Check
void startOfActivity(const core::Activity& activity);
void endOfActivity(const core::Activity& activity);

//TODO: Unique Input string
// TODO: Unique Input string
static o2::header::DataDescription createCheckDataDescription(const std::string& checkName);

UpdatePolicyType getUpdatePolicyType() const;
Expand All @@ -81,7 +81,7 @@ class Check

// todo: probably make CheckFactory
static CheckConfig extractConfig(const core::CommonSpec&, const CheckSpec&);
static framework::OutputSpec createOutputSpec(const std::string& checkName);
static framework::OutputSpec createOutputSpec(const std::string& detector, const std::string& checkName);

private:
void beautify(std::map<std::string, std::shared_ptr<core::MonitorObject>>& moMap, const core::Quality& quality);
Expand Down
9 changes: 6 additions & 3 deletions Framework/src/Check.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,17 @@ CheckConfig Check::extractConfig(const CommonSpec& commonSpec, const CheckSpec&
checkAllObjects,
allowBeautify,
std::move(inputs),
createOutputSpec(checkSpec.checkName),
createOutputSpec(checkSpec.detectorName, checkSpec.checkName),
commonSpec.conditionDBUrl
};
}

framework::OutputSpec Check::createOutputSpec(const std::string& checkName)
framework::OutputSpec Check::createOutputSpec(const std::string& detector, const std::string& checkName)
{
return { "QC", createCheckDataDescription(checkName), 0, framework::Lifetime::Sporadic };
using Origin = o2::header::DataOrigin;
Origin header;
header.runtimeInit(std::string{ "C" }.append(detector.substr(0, Origin::size)).c_str());
Copy link
Collaborator

@knopers8 knopers8 Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
header.runtimeInit(std::string{ "C" }.append(detector.substr(0, Origin::size)).c_str());
header.runtimeInit(std::string{ "C" }.append(detector.substr(0, Origin::size - 1)).c_str());

If you get a 4-letter detector code, won't you pass a 5-letter string to runtimeInit?

FYI, we allow for some detector names which are longer than 3, but it's OK to trim them:

std::vector<std::string> permitted = { "MISC", "DAQ", "GENERAL", "TST", "BMK", "CTP", "TRG", "DCS", "GLO", "FIT" };

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I would propose to extract the logic into a separate createCheckDataOrigin method.

return { header, createCheckDataDescription(checkName), 0, framework::Lifetime::Sporadic };
}

void Check::startOfActivity(const core::Activity& activity)
Expand Down
4 changes: 2 additions & 2 deletions Framework/test/testCheck.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(test_check_specs)
BOOST_REQUIRE_EQUAL(check.getInputs().size(), 1);
BOOST_CHECK_EQUAL(check.getInputs()[0], (InputSpec{ { "mo" }, "QTST", "skeletonTask", 0, Lifetime::Sporadic }));

BOOST_CHECK_EQUAL(check.getOutputSpec(), (OutputSpec{ "QC", "singleCheck-chk", 0, Lifetime::Sporadic }));
BOOST_CHECK_EQUAL(check.getOutputSpec(), (OutputSpec{ "CDET", "singleCheck-chk", 0, Lifetime::Sporadic }));
}

std::shared_ptr<MonitorObject> dummyMO(const std::string& objName)
Expand Down Expand Up @@ -161,4 +161,4 @@ BOOST_AUTO_TEST_CASE(test_check_activity)
BOOST_REQUIRE_EQUAL(qos.size(), 1);
ValidityInterval correctValidity{ 1, 15 };
BOOST_CHECK(qos[0]->getActivity().mValidity == correctValidity);
}
}
4 changes: 2 additions & 2 deletions Framework/test/testCheckWorkflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ using namespace o2::configuration;

/**
* Test description
*
*
* Test a complex configuration with 3 tasks and 4 checks.
* Checks sources contain several tasks with different policies.
*
Expand Down Expand Up @@ -110,7 +110,7 @@ class Receiver : public framework::Task
{
Inputs inputs;
for (auto& checkName : mNames) {
inputs.push_back({ checkName, "QC", Check::createCheckDataDescription(checkName), Lifetime::Sporadic });
inputs.push_back({ checkName, "CTST", Check::createCheckDataDescription(checkName), Lifetime::Sporadic });
}
return inputs;
}
Expand Down
2 changes: 1 addition & 1 deletion Framework/test/testWorkflow.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const&)
DataProcessorSpec receiver{
"receiver",
Inputs{
{ "checked-mo", "QC", Check::createCheckDataDescription(getFirstCheckName(qcConfigurationSource)), 0, Lifetime::Sporadic } },
{ "checked-mo", "CTST", Check::createCheckDataDescription(getFirstCheckName(qcConfigurationSource)), 0, Lifetime::Sporadic } },
Outputs{},
AlgorithmSpec{
[](ProcessingContext& pctx) {
Expand Down