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

Move FINISHED_KEY and FAILED_KEY to base Calculation class #1314

Merged
Show file tree
Hide file tree
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
Move FINISHED_KEY and FAILED_KEY to base Calculation class
Both the WorkCalculation and JobCalculation, through the JobProcess
need access to these keys that represent updatable attributes
  • Loading branch information
sphuber committed Mar 21, 2018
commit 66d16301ceefe8fbbc7031597c201ae14f44a202
16 changes: 15 additions & 1 deletion aiida/orm/implementation/general/calculation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,21 @@ class AbstractCalculation(Sealable):
calculations run via a scheduler.
"""

_updatable_attributes = Sealable._updatable_attributes + ('state',)
FINISHED_KEY = '_finished'
FAILED_KEY = '_failed'

_updatable_attributes = Sealable._updatable_attributes + ('state', FINISHED_KEY, FAILED_KEY)
_cacheable = False

@classproperty
def _hash_ignored_attributes(cls):
return super(AbstractCalculation, cls)._hash_ignored_attributes + [
'_sealed',
'_finished',
]

# The link_type might not be correct while the object is being created.
_hash_ignored_inputs = ['CALL']

# Nodes that can be added as input using the use_* methods
@classproperty
Expand Down
6 changes: 2 additions & 4 deletions aiida/orm/implementation/general/calculation/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ class WorkCalculation(Calculation):
Used to represent a calculation generated by a Process from the new
workflows system.
"""
FINISHED_KEY = '_finished'
FAILED_KEY = '_failed'

ABORTED_KEY = '_aborted'
DO_ABORT_KEY = '_do_abort'

_updatable_attributes = Calculation._updatable_attributes + (
FINISHED_KEY, FAILED_KEY, ABORTED_KEY, DO_ABORT_KEY)
_updatable_attributes = Calculation._updatable_attributes + (ABORTED_KEY, DO_ABORT_KEY)

@override
def has_finished(self):
Expand Down