Skip to content
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

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

Merged
merged 4 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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 .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
9 changes: 7 additions & 2 deletions Framework/include/QualityControl/Check.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,21 @@ 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);

/// \brief creates DataOrigin for Check task in form CDET
///
/// \param detector Name of the detector to be used. If longer than 3B it will be truncated
static o2::header::DataOrigin createCheckDataOrigin(const std::string& detector);

UpdatePolicyType getUpdatePolicyType() const;
std::vector<std::string> getObjectsNames() const;
bool getAllObjectsOption() const;

// 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
14 changes: 11 additions & 3 deletions Framework/src/Check.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ o2::header::DataDescription Check::createCheckDataDescription(const std::string&
return description;
}

o2::header::DataOrigin Check::createCheckDataOrigin(const std::string& detector)
{
using Origin = o2::header::DataOrigin;
Origin header;
header.runtimeInit(std::string{ "C" }.append(detector.substr(0, Origin::size - 1)).c_str());
return header;
}

/// Members
Check::Check(CheckConfig config)
: mCheckConfig(std::move(config))
Expand Down Expand Up @@ -260,14 +268,14 @@ 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 };
return { createCheckDataOrigin(detector), 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
Loading