Skip to content

Commit

Permalink
Move FINISHED_KEY and FAILED_KEY to base Calculation class
Browse files Browse the repository at this point in the history
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
1 parent 267bd05 commit 66d1630
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
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

0 comments on commit 66d1630

Please sign in to comment.