Skip to content

Commit 5c07f34

Browse files
committed
DPL: clean up leftovers from input stream after parsing a workflow
1 parent cb59999 commit 5c07f34

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Framework/Core/src/WorkflowSerializationHelpers.cxx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <memory>
3030

3131
O2_DECLARE_DYNAMIC_LOG(workflow_importer);
32+
O2_DECLARE_DYNAMIC_LOG(post_workflow_importer);
3233

3334
namespace o2::framework
3435
{
@@ -969,7 +970,19 @@ bool WorkflowSerializationHelpers::import(std::istream& s,
969970
WorkflowImporter importer{workflow, metadata, command};
970971
bool ok = reader.Parse(isw, importer);
971972
if (ok == false) {
972-
throw std::runtime_error("Error while parsing serialised workflow");
973+
if (s.eof()) {
974+
throw std::runtime_error("Error while parsing serialised workflow");
975+
} else {
976+
// clean up leftovers at the end of the input stream, e.g. [DEBUG] message from destructors
977+
while (true) {
978+
O2_SIGNPOST_ID_GENERATE(sid, post_workflow_importer);
979+
s.getline(buf, 1024, '\n');
980+
if (s.eof()) {
981+
break;
982+
}
983+
O2_SIGNPOST_EVENT_EMIT(post_workflow_importer, sid, "post import", "Following leftover line found in input stream after parsing workflow: %{public}s", buf);
984+
}
985+
}
973986
}
974987
return true;
975988
}

0 commit comments

Comments
 (0)