-
Notifications
You must be signed in to change notification settings - Fork 192
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 method to enable/disable process handlers
#3786
BaseRestartWorkChain
: add method to enable/disable process handlers
#3786
Conversation
Thanks, @sphuber, I will test it in lsmo-epfl/aiida-raspa#56 and will let you know. |
The `process_handler` decorator is updated with a new keyword argument `enabled` which is by default `True`. By setting it to `False` the process handler is disabled and will always be skipped during the `inspect_process` outline step. This default can be overridden on a per instance basis through a new input called `handler_overrides`. The base spec of `BaseRestartWorkChain` defines this new base input called `handler_overrides` which takes a mapping of process handler names to a boolean. For `True` the process handler is enabled and for `False` it is disabled, where disabled means that during the `inspect_process` call it is not called but skipped. The validator on the port ensures that the keys correspond to actual instance methods of the work chain that are decorated with `process_handler`. The value specified in `handler_overrides`, as the name suggests, override the default value specified in the decorator.
e8c5b9f
to
2789ea9
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.
Thanks a lot, @sphuber. I tested the updated functionality of the base restart work chain on aiida-raspa work chains and everything seems to work without a problem. In particular, I tested disabling/enabling handlers that are enabled/disabled by default and get_process_handlers()
function (see my note below).
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.
Great stuff!
Fixes #3773
The
process_handler
decorator is updated with a new keyword argumentenabled
which is by defaultTrue
. By setting it toFalse
theprocess handler is disabled and will always be skipped during the
inspect_process
outline step. This default can be overridden on a perinstance basis through a new input called
handler_overrides
.The base spec of
BaseRestartWorkChain
defines this new base inputcalled
handler_overrides
which takes a mapping of process handlernames to a boolean. For
True
the process handler is enabled and forFalse
it is disabled, where disabled means that during theinspect_process
call it is not called but skipped. The validator onthe port ensures that the keys correspond to actual instance methods of
the work chain that are decorated with
process_handler
. The valuespecified in
handler_overrides
, as the name suggests, override thedefault value specified in the decorator.