Skip to content

Commit 12eb5a4

Browse files
committed
DPL: fix OutputSpec metadata ignored in workflow deserialization
1 parent cfb2c3a commit 12eb5a4

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

Framework/Core/src/WorkflowSerializationHelpers.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,11 @@ struct WorkflowImporter : public rapidjson::BaseReaderHandler<rapidjson::UTF8<>,
430430
inputMatcherNodes.push_back(std::move(node));
431431
} else if (in(State::IN_OUTPUT)) {
432432
if (outputHasSubSpec) {
433-
dataProcessors.back().outputs.push_back(OutputSpec({binding}, origin, description, subspec, lifetime));
433+
dataProcessors.back().outputs.push_back(OutputSpec({binding}, origin, description, subspec, lifetime, outputOptions));
434434
} else {
435-
dataProcessors.back().outputs.push_back(OutputSpec({binding}, {origin, description}, lifetime));
435+
dataProcessors.back().outputs.push_back(OutputSpec({binding}, {origin, description}, lifetime, outputOptions));
436436
}
437+
outputOptions.clear();
437438
outputHasSubSpec = false;
438439
} else if (in(State::IN_OPTION)) {
439440
std::unique_ptr<ConfigParamSpec> opt{nullptr};

Framework/Core/test/test_WorkflowSerialization.cxx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,36 @@ TEST_CASE("TestVerifyWildcard")
120120
// also check if the conversion to ConcreteDataMatcher is working at import
121121
// REQUIRE(std::get_if<ConcreteDataTypeMatcher>(&w1[0].inputs[0].matcher) != nullptr);;
122122
}
123+
124+
TEST_CASE("TestInputOutputSpecMetadata")
125+
{
126+
WorkflowSpec wso{
127+
DataProcessorSpec{
128+
.name = "S1",
129+
.outputs = {OutputSpec{OutputLabel{"o1"}, o2::header::DataOrigin{"TST"}, "OUTPUT1", 0, Lifetime::Timeframe, {{"param1", VariantType::Bool, true, ConfigParamSpec::HelpString{"\"\""}}, {"param2", VariantType::Bool, true, ConfigParamSpec::HelpString{"\"\""}}}},
130+
OutputSpec{OutputLabel{"o2"}, o2::header::DataOrigin{"TST"}, "OUTPUT2"}}}};
131+
132+
std::vector<DataProcessorInfo> dataProcessorInfoOut{
133+
{.name = "S1", .executable = "test_Framework_test_SerializationWorkflow"},
134+
};
135+
136+
CommandInfo commandInfoOut{"o2-dpl-workflow -b"};
137+
138+
std::vector<DataProcessorInfo> dataProcessorInfoIn{};
139+
CommandInfo commandInfoIn;
140+
141+
std::ostringstream firstDump;
142+
WorkflowSerializationHelpers::dump(firstDump, wso, dataProcessorInfoOut, commandInfoOut);
143+
std::istringstream is;
144+
is.str(firstDump.str());
145+
146+
WorkflowSpec wsi;
147+
WorkflowSerializationHelpers::import(is, wsi, dataProcessorInfoIn, commandInfoIn);
148+
149+
REQUIRE(wsi[0].outputs[0].metadata.size() == 2);
150+
REQUIRE(wsi[0].outputs[1].metadata.size() == 0);
151+
REQUIRE(wso[0].outputs[0].metadata.size() == wsi[0].outputs[0].metadata.size());
152+
REQUIRE(wso[0].outputs[1].metadata.size() == wsi[0].outputs[1].metadata.size());
153+
REQUIRE(wso[0].outputs[0].metadata[0] == wsi[0].outputs[0].metadata[0]);
154+
REQUIRE(wso[0].outputs[0].metadata[1] == wsi[0].outputs[0].metadata[1]);
155+
}

0 commit comments

Comments
 (0)