Skip to content

Commit 368bc58

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

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,38 @@ 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+
};
133+
134+
std::vector<DataProcessorInfo> dataProcessorInfoOut{
135+
{.name = "S1", .executable = "test_Framework_test_SerializationWorkflow"},
136+
};
137+
138+
CommandInfo commandInfoOut{"o2-dpl-workflow -b"};
139+
140+
std::vector<DataProcessorInfo> dataProcessorInfoIn{};
141+
CommandInfo commandInfoIn;
142+
143+
std::ostringstream firstDump;
144+
WorkflowSerializationHelpers::dump(firstDump, wso, dataProcessorInfoOut, commandInfoOut);
145+
std::istringstream is;
146+
is.str(firstDump.str());
147+
148+
WorkflowSpec wsi;
149+
WorkflowSerializationHelpers::import(is, wsi, dataProcessorInfoIn, commandInfoIn);
150+
151+
REQUIRE(wsi[0].outputs[0].metadata.size() == 2);
152+
REQUIRE(wsi[0].outputs[1].metadata.size() == 0);
153+
REQUIRE(wso[0].outputs[0].metadata.size() == wsi[0].outputs[0].metadata.size());
154+
REQUIRE(wso[0].outputs[1].metadata.size() == wsi[0].outputs[1].metadata.size());
155+
REQUIRE(wso[0].outputs[0].metadata[0] == wsi[0].outputs[0].metadata[0]);
156+
REQUIRE(wso[0].outputs[0].metadata[1] == wsi[0].outputs[0].metadata[1]);
157+
}

0 commit comments

Comments
 (0)