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
d1aca94b
Commit
d1aca94b
authored
Jun 10, 2021
by
Wout De Nolf
Browse files
fixup
parent
6e4dae58
Changes
2
Hide whitespace changes
Inline
Side-by-side
esrftaskgraph/esrftaskgraph/methodtask.py
View file @
d1aca94b
...
...
@@ -3,15 +3,11 @@ from esrftaskgraph.utils import import_method
class
MethodExecutorTask
(
Task
,
input_names
=
[
"method"
],
output_names
=
[
"return_value"
]):
@
property
def
method
(
self
):
fullname
=
self
.
inputs
.
method
return
import_method
(
fullname
)
def
process
(
self
):
method_kwargs
=
self
.
input_values
method_kwargs
.
pop
(
"method"
)
fullname
=
method_kwargs
.
pop
(
"method"
)
method
=
import_method
(
fullname
)
result
=
self
.
method
(
**
method_kwargs
)
result
=
method
(
**
method_kwargs
)
self
.
outputs
.
return_value
=
result
esrftaskgraph/esrftaskgraph/ppftasks.py
View file @
d1aca94b
...
...
@@ -9,21 +9,22 @@ class PpfMethodExecutorTask(
output_names
=
[
"ppfdict"
],
):
"""Ppf workflows pass one dictionary around between tasks and this dictionary
gets updates by each task.
gets updates by each task. This dictionary is unpacked into the unexpected
arguments and passed to the method.
"""
def
process
(
self
):
ppfdict
=
self
.
input_values
fullname
=
ppfdict
.
pop
(
"method"
)
method_kwargs
=
self
.
input_values
fullname
=
method_kwargs
.
pop
(
"method"
)
method
=
import_method
(
fullname
)
ppfdict
_unpack
=
ppfdict
.
pop
(
"ppfdict"
,
None
)
if
ppfdict
_unpack
:
ppfdict
.
update
(
ppfdict
_unpack
)
ppfdict
=
method_kwargs
.
pop
(
"ppfdict"
,
None
)
if
ppfdict
:
method_kwargs
.
update
(
ppfdict
)
result
=
method
(
**
ppfdict
)
result
=
method
(
**
method_kwargs
)
ppfdict
.
update
(
result
)
self
.
outputs
.
ppfdict
=
ppfdict
method_kwargs
.
update
(
result
)
self
.
outputs
.
ppfdict
=
method_kwargs
class
PpfPortTask
(
...
...
@@ -32,10 +33,10 @@ class PpfPortTask(
"""A ppfmethod which represents the identity mapping"""
def
process
(
self
):
ppfdict
=
self
.
input_values
ppfdict
.
pop
(
"ppfport"
)
# not used
ppfdict
_unpack
=
ppfdict
.
pop
(
"ppfdict"
,
None
)
if
ppfdict
_unpack
:
ppfdict
.
update
(
ppfdict
_unpack
)
method_kwargs
=
self
.
input_values
method_kwargs
.
pop
(
"ppfport"
)
# not used
ppfdict
=
method_kwargs
.
pop
(
"ppfdict"
,
None
)
if
ppfdict
:
method_kwargs
.
update
(
ppfdict
)
self
.
outputs
.
ppfdict
=
ppfdict
self
.
outputs
.
ppfdict
=
method_kwargs
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