aiida.orm.implementation.django.calculation.job package

class aiida.orm.implementation.django.calculation.job.JobCalculation(**kwargs)[source]

Bases: aiida.orm.implementation.general.calculation.job.AbstractJobCalculation, aiida.orm.implementation.django.calculation.Calculation

__abstractmethods__ = frozenset([])
__module__ = 'aiida.orm.implementation.django.calculation.job'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 38
_abc_registry = <_weakrefset.WeakSet object>
classmethod _list_calculations_old(states=None, past_days=None, group=None, group_pk=None, all_users=False, pks=[], relative_ctime=True)[source]

Return a string with a description of the AiiDA calculations.

Todo

does not support the query for the IMPORTED state (since it checks the state in the Attributes, not in the DbCalcState table). Decide which is the correct logic and implement the correct query.

Parameters:
  • states – a list of string with states. If set, print only the calculations in the states “states”, otherwise shows all. Default = None.
  • past_days – If specified, show only calculations that were created in the given number of past days.
  • group – If specified, show only calculations belonging to a user-defined group with the given name. Can use colons to separate the group name from the type, as specified in aiida.orm.group.Group.get_from_string() method.
  • group_pk – If specified, show only calculations belonging to a user-defined group with the given PK.
  • pks – if specified, must be a list of integers, and only calculations within that list are shown. Otherwise, all calculations are shown. If specified, sets state to None and ignores the value of the past_days option.”)
  • relative_ctime – if true, prints the creation time relative from now. (like 2days ago). Default = True
  • all_users – if True, list calculation belonging to all users. Default = False
Returns:

a string with description of calculations.

_logger = <logging.Logger object>
_plugin_type_string = 'calculation.job.JobCalculation.'
_query_type_string = 'calculation.job.'
_set_state(state)[source]

Set the state of the calculation.

Set it in the DbCalcState to have also the uniqueness check. Moreover (except for the IMPORTED state) also store in the ‘state’ attribute, useful to know it also after importing, and for faster querying.

Todo

Add further checks to enforce that the states are set in order?

Parameters:state – a string with the state. This must be a valid string, from aiida.common.datastructures.calc_states.
Raise:ModificationNotAllowed if the given state was already set.
get_state(from_attribute=False)[source]

Get the state of the calculation.

Note

this method returns the NOTFOUND state if no state is found in the DB.

Note

the ‘most recent’ state is obtained using the logic in the aiida.common.datastructures.sort_states function.

Todo

Understand if the state returned when no state entry is found in the DB is the best choice.

Parameters:from_attribute – if set to True, read it from the attributes (the attribute is also set with set_state, unless the state is set to IMPORTED; in this way we can also see the state before storing).
Returns:a string. If from_attribute is True and no attribute is found, return None. If from_attribute is False and no entry is found in the DB, return the “NOTFOUND” state.