Commit c92a6875 authored by payno's avatar payno
Browse files

Merge branch '16-using-result_value-in-method-tasks' into 'main'

Resolve "Using `result_value` in method tasks"

Closes #16

See merge request !70
parents 20761581 43904a47
Pipeline #59655 passed with stages
in 2 minutes and 9 seconds
......@@ -192,7 +192,12 @@ def add_dynamic_inputs(dynamic_inputs: dict, link_attrs: dict, source_results: d
except KeyError:
raise KeyError(f"Argument '{arg}' is missing an 'input' key") from None
if output_arg:
dynamic_inputs[input_arg] = source_results[output_arg]
try:
dynamic_inputs[input_arg] = source_results[output_arg]
except KeyError:
raise KeyError(
f"'{output_arg}' is not an output variable of the source task"
) from None
else:
dynamic_inputs[input_arg] = source_results
......
......@@ -233,6 +233,13 @@ class Task(Registered, UniversalHashable, register=False):
else:
data["label"] = None
@property
def label(self):
if self.__label:
return self.__label
else:
return str(self)
def _iter_missing_input_values(self):
for iname in self._INPUT_NAMES:
var = self._inputs.get(iname)
......@@ -268,11 +275,7 @@ class Task(Registered, UniversalHashable, register=False):
except Exception as e:
self._exception = e
if raise_on_error:
if self.__label:
label = self.__label
else:
label = str(self)
raise RuntimeError(f"Task '{label}' failed") from e
raise RuntimeError(f"Task '{self.label}' failed") from e
else:
self._done = True
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment