From 33a29aa3ff1257ec41e35a36674bf53c8050cdea Mon Sep 17 00:00:00 2001 From: Ralf Grubenmann Date: Mon, 5 Feb 2024 17:13:08 +0100 Subject: [PATCH] fix(cli): don't fail on workflows without inputs/outputs and print approriate warnings (#3694) --- renku/core/workflow/model/concrete_execution_graph.py | 4 ++++ renku/domain_model/workflow/plan.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/renku/core/workflow/model/concrete_execution_graph.py b/renku/core/workflow/model/concrete_execution_graph.py index 6eb513c282..aac2fca0de 100644 --- a/renku/core/workflow/model/concrete_execution_graph.py +++ b/renku/core/workflow/model/concrete_execution_graph.py @@ -23,6 +23,7 @@ from networkx.algorithms.cycles import simple_cycles from renku.core.errors import ParameterError +from renku.core.util import communication from renku.core.util.os import are_paths_related from renku.domain_model.workflow import composite_plan, parameter, plan @@ -65,6 +66,9 @@ def calculate_concrete_execution_graph(self, virtual_links: bool = False): else: if not virtual_links: continue + if not workflow.inputs and not workflow.outputs: + communication.warn(f"Workflow {workflow.name} has no inputs and outputs.") + self.graph.add_node(workflow) for input in workflow.inputs: inputs[input.actual_value].append(input) diff --git a/renku/domain_model/workflow/plan.py b/renku/domain_model/workflow/plan.py index 95b179f200..6c2e85f54f 100644 --- a/renku/domain_model/workflow/plan.py +++ b/renku/domain_model/workflow/plan.py @@ -27,6 +27,7 @@ from werkzeug.utils import secure_filename from renku.core import errors +from renku.core.util import communication from renku.core.util.datetime8601 import local_now from renku.domain_model.provenance.agent import Person from renku.domain_model.provenance.annotation import Annotation @@ -195,6 +196,11 @@ def __init__( ): self.annotations: List[Annotation] = annotations or [] self.command: str = command + cmd = self.command.split(" ", 1)[0] + if cmd == "renku" or cmd.endswith("/renku"): + communication.error( + f"Calling the 'renku' executable in workflows is not supported. Occurred in workflow {name}." + ) self.hidden_inputs: List[HiddenInput] = hidden_inputs or [] self.inputs: List[CommandInput] = inputs or [] self.outputs: List[CommandOutput] = outputs or []