From 9683dee1fe7d891f15bb64dd15f8d19cb4df434d Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 28 Jan 2025 09:38:31 +0100 Subject: [PATCH] DPL: avoid asserting the workflow is empty This is a property that depends on user input, so an empty workflow is actually possible and should be handled. This currently breaks if the empty workflow is provided in debug mode. --- Framework/Core/src/DeviceSpecHelpers.cxx | 4 ++++ Framework/Core/src/WorkflowHelpers.cxx | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Framework/Core/src/DeviceSpecHelpers.cxx b/Framework/Core/src/DeviceSpecHelpers.cxx index f2644ed66ba08..ec0a40e44ac31 100644 --- a/Framework/Core/src/DeviceSpecHelpers.cxx +++ b/Framework/Core/src/DeviceSpecHelpers.cxx @@ -1118,6 +1118,10 @@ void DeviceSpecHelpers::dataProcessorSpecs2DeviceSpecs(const WorkflowSpec& workf { // Always check for validity of the workflow before instanciating it DeviceSpecHelpers::validate(workflow); + // In case the workflow is empty, we simply do not need to instanciate any device. + if (workflow.empty()) { + return; + } std::vector availableForwardsInfo; std::vector logicalEdges; std::vector connections; diff --git a/Framework/Core/src/WorkflowHelpers.cxx b/Framework/Core/src/WorkflowHelpers.cxx index 597f3d32856c1..b18b559fe99fb 100644 --- a/Framework/Core/src/WorkflowHelpers.cxx +++ b/Framework/Core/src/WorkflowHelpers.cxx @@ -756,7 +756,10 @@ void WorkflowHelpers::constructGraph(const WorkflowSpec& workflow, std::vector& outputs, std::vector& forwardedInputsInfo) { - assert(!workflow.empty()); + // In case the workflow is empty, we do not have anything to do. + if (workflow.empty()) { + return; + } // This is the state. Oif is the iterator I use for the searches. std::vector availableOutputsInfo;