Commit 3612535c authored by Wout De Nolf's avatar Wout De Nolf
Browse files

esrftaskgraph: better check for required positional Task inputs

parent 4f078293
......@@ -40,6 +40,14 @@ class Task(Registered, hashing.UniversalHashable, register=False):
if missing_required:
raise ValueError(f"Missing inputs for {type(self)}: {missing_required}")
# Check required positional inputs
nrequiredargs = self._N_REQUIRED_POSITIONAL_INPUTS
for i in range(nrequiredargs):
if i not in inputs and str(i) not in inputs:
raise ValueError(
f"Missing inputs for {type(self)}: positional argument #{i}"
)
# Init missing optional inputs
missing_optional = set(self._OPTIONAL_INPUT_NAMES) - set(inputs.keys())
for name in missing_optional:
......@@ -54,13 +62,6 @@ class Task(Registered, hashing.UniversalHashable, register=False):
# The output hash will update dynamically if any of the input
# variables change
self._inputs = VariableContainer(value=inputs, varinfo=varinfo)
nargs = self._inputs.n_positional_variables
nrequiredargs = self._N_REQUIRED_POSITIONAL_INPUTS
if nargs < nrequiredargs:
raise ValueError(
f"Missing positional inputs for {type(self)}: {nrequiredargs} required but only {nargs} provided"
)
self._outputs = VariableContainer(
value=ovars,
uhash=self._inputs,
......
Markdown is supported
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