-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BaseRestartWorkChain
: add the get_outputs
hook
#5618
BaseRestartWorkChain
: add the get_outputs
hook
#5618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @sphuber! Field tested in the context of aiidateam/aiida-quantumespresso#818, and it serves this use case perfectly. But maybe we should still add a bit more explanation on why there is a separate method to get the outputs?
@@ -295,6 +295,10 @@ def inspect_process(self) -> Optional['ExitCode']: # pylint: disable=too-many-b | |||
|
|||
return None | |||
|
|||
def get_outputs(self, node) -> Mapping[str, orm.Node]: | |||
"""Return a mapping of the outputs that should be attached as outputs to the work chain.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still add a sentence of two explaining that this method can be overridden in case the BaseRestartWorkChain
needs to adjust the outputs of the underlying CalcJob
somehow?
ea0e533
to
a659314
Compare
Thanks @mbercx . I have updated the docstring and added some documentation |
The `BaseRestartWorkChain`, in the `results` outline step, will take the outputs of the last completed `CalcJob` and attach them to the work chain itself. There are use cases where the implementation may want to slightly adapt the outputs before attaching them. By abstracting the code that fetches the outputs to a separate method `get_outputs`, it provides a hook for implementations to customize this behavior.
a659314
to
92e874f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent, sounds clear to me! 👍
Fixes #5617
The
BaseRestartWorkChain
, in theresults
outline step, will take theoutputs of the last completed
CalcJob
and attach them to the workchain itself. There are use cases where the implementation may want to
slightly adapt the outputs before attaching them. By abstracting the
code that fetches the outputs to a separate method
get_outputs
, itprovides a hook for implementations to customize this behavior.