Skip to content
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

docs: update documentation of is_valid_cache #5404

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions aiida/engine/processes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,12 +944,14 @@ def _get_namespace_list(namespace: Optional[str] = None, agglomerate: bool = Tru
def is_valid_cache(cls, node: orm.ProcessNode) -> bool:
"""Check if the given node can be cached from.

.. warning :: When overriding this method, make sure to call
super().is_valid_cache(node) and respect its output. Otherwise,
the 'invalidates_cache' keyword on exit codes will not work.
Overriding this method allows ``Process`` sub-classes to modify when
corresponding process nodes are considered as a cache.

.. warning :: When overriding this method, make sure to return ``False``
*at least* in all cases when ``super().is_valid_cache(node)``
returns ``False``. Otherwise, the ``invalidates_cache`` keyword on exit
codes may have no effect.

This method allows extending the behavior of `ProcessNode.is_valid_cache`
from `Process` sub-classes, for example in plug-ins.
"""
try:
return not cls.spec().exit_codes(node.exit_status).invalidates_cache
Expand Down