Skip to content

Commit 0d7c376

Browse files
committed
DPL: improve debug information in case of circular dependencies.
1 parent d9d6894 commit 0d7c376

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Framework/Core/src/runDataProcessing.cxx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,6 +2835,20 @@ std::unique_ptr<o2::framework::ServiceRegistry> createRegistry()
28352835
return std::make_unique<o2::framework::ServiceRegistry>();
28362836
}
28372837

2838+
void describeDataProcessorSpec(std::ostream& stream, DataProcessorSpec const& spec)
2839+
{
2840+
stream << spec.name;
2841+
if (!spec.labels.empty()) {
2842+
stream << "(";
2843+
bool first = false;
2844+
for (auto& label : spec.labels) {
2845+
stream << (first ? "" : ",") << label.value;
2846+
first = true;
2847+
}
2848+
stream << ")";
2849+
}
2850+
}
2851+
28382852
// This is a toy executor for the workflow spec
28392853
// What it needs to do is:
28402854
//
@@ -3059,18 +3073,22 @@ int doMain(int argc, char** argv, o2::framework::WorkflowSpec const& workflow,
30593073
edges.emplace_back(i, j);
30603074
if (both) {
30613075
std::ostringstream str;
3076+
describeDataProcessorSpec(str, physicalWorkflow[i]);
3077+
str << " has circular dependency with ";
3078+
describeDataProcessorSpec(str, physicalWorkflow[j]);
3079+
str << ":\n";
30623080
for (auto x : {i, j}) {
30633081
str << physicalWorkflow[x].name << ":\n";
30643082
str << "inputs:\n";
30653083
for (auto& input : physicalWorkflow[x].inputs) {
3066-
str << "- " << input << "\n";
3084+
str << "- " << input << " " << (int)input.lifetime << "\n";
30673085
}
30683086
str << "outputs:\n";
30693087
for (auto& output : physicalWorkflow[x].outputs) {
3070-
str << "- " << output << "\n";
3088+
str << "- " << output << " " << (int)output.lifetime << "\n";
30713089
}
30723090
}
3073-
throw std::runtime_error(physicalWorkflow[i].name + " has circular dependency with " + physicalWorkflow[j].name + ":\n" + str.str());
3091+
throw std::runtime_error(str.str());
30743092
}
30753093
}
30763094
}

0 commit comments

Comments
 (0)