From 0d7c376afa4eb0453ca95ef6eccabc1011137906 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 8 Jul 2025 11:53:02 +0200 Subject: [PATCH] DPL: improve debug information in case of circular dependencies. --- Framework/Core/src/runDataProcessing.cxx | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Framework/Core/src/runDataProcessing.cxx b/Framework/Core/src/runDataProcessing.cxx index f1111da79edd5..d691041a366cf 100644 --- a/Framework/Core/src/runDataProcessing.cxx +++ b/Framework/Core/src/runDataProcessing.cxx @@ -2835,6 +2835,20 @@ std::unique_ptr createRegistry() return std::make_unique(); } +void describeDataProcessorSpec(std::ostream& stream, DataProcessorSpec const& spec) +{ + stream << spec.name; + if (!spec.labels.empty()) { + stream << "("; + bool first = false; + for (auto& label : spec.labels) { + stream << (first ? "" : ",") << label.value; + first = true; + } + stream << ")"; + } +} + // This is a toy executor for the workflow spec // What it needs to do is: // @@ -3059,18 +3073,22 @@ int doMain(int argc, char** argv, o2::framework::WorkflowSpec const& workflow, edges.emplace_back(i, j); if (both) { std::ostringstream str; + describeDataProcessorSpec(str, physicalWorkflow[i]); + str << " has circular dependency with "; + describeDataProcessorSpec(str, physicalWorkflow[j]); + str << ":\n"; for (auto x : {i, j}) { str << physicalWorkflow[x].name << ":\n"; str << "inputs:\n"; for (auto& input : physicalWorkflow[x].inputs) { - str << "- " << input << "\n"; + str << "- " << input << " " << (int)input.lifetime << "\n"; } str << "outputs:\n"; for (auto& output : physicalWorkflow[x].outputs) { - str << "- " << output << "\n"; + str << "- " << output << " " << (int)output.lifetime << "\n"; } } - throw std::runtime_error(physicalWorkflow[i].name + " has circular dependency with " + physicalWorkflow[j].name + ":\n" + str.str()); + throw std::runtime_error(str.str()); } } }