Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
payno
workflow_concepts
Commits
3612535c
Commit
3612535c
authored
Jun 12, 2021
by
Wout De Nolf
Browse files
esrftaskgraph: better check for required positional Task inputs
parent
4f078293
Changes
1
Hide whitespace changes
Inline
Side-by-side
esrftaskgraph/esrftaskgraph/task.py
View file @
3612535c
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment