aiida.restapi.translator.nodes.process.calculation package#

Submodules#

Translator for calcfunction node

class aiida.restapi.translator.nodes.process.calculation.calcfunction.CalcFunctionTranslator(**kwargs)[source]#

Bases: ProcessTranslator

Translator relative to resource ‘calcfunction’ and aiida class Calculation

class CalcFunctionNode(backend: StorageBackend | None = None, user: User | None = None, computer: Computer | None = None, **kwargs: Any)#

Bases: FunctionCalculationMixin, CalculationNode

ORM class for all nodes representing the execution of a calcfunction.

alias of CalcFunctionNodeLinks

__abstractmethods__ = frozenset({})#
__annotations__ = {'METADATA_INPUTS_KEY': 'str', '_CLS_COLLECTION': 'Type[CollectionType]', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__module__ = 'aiida.orm.nodes.process.calculation.calcfunction'#
__parameters__ = ()#
__plugin_type_string: ClassVar[str]#
__query_type_string: ClassVar[str]#
_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.process.calculation.calcfunction.CalcFunctionNode (WARNING)>#
fields: QbFields = {'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'computer_pk': 'QbNumericField(attributes.computer_pk) -> Optional[int]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'exception': 'QbStrField(attributes.exception) -> Optional[str]',  'exit_message': 'QbStrField(attributes.exit_message) -> Optional[str]',  'exit_status': 'QbNumericField(attributes.exit_status) -> Optional[int]',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'label': 'QbStrField(label) -> str',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'paused': 'QbField(attributes.paused) -> bool',  'pk': 'QbNumericField(pk) -> int',  'process_label': 'QbStrField(attributes.process_label) -> Optional[str]',  'process_state': 'QbStrField(attributes.process_state) -> Optional[str]',  'process_status': 'QbStrField(attributes.process_status) -> Optional[str]',  'process_type': 'QbStrField(attributes.process_type) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'sealed': 'QbField(attributes.sealed) -> bool',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
__annotations__ = {}#
__label__ = 'calcfunction'#
__module__ = 'aiida.restapi.translator.nodes.process.calculation.calcfunction'#
_aiida_class#

alias of CalcFunctionNode

_aiida_type = 'process.calculation.calcfunction.CalcFunctionNode'#
_result_type = 'calcfunction'#
static get_derived_properties(node)[source]#

Generic function extended for calcfunction. Currently it is not implemented.

Parameters:

node – node object

Returns:

empty dict

Translator for calcjob node

class aiida.restapi.translator.nodes.process.calculation.calcjob.CalcJobTranslator(**kwargs)[source]#

Bases: ProcessTranslator

Translator relative to resource ‘calculations’ and aiida class Calculation

class CalcJobNode(backend: StorageBackend | None = None, user: User | None = None, computer: Computer | None = None, **kwargs: Any)#

Bases: CalculationNode

ORM class for all nodes representing the execution of a CalcJob.

CALC_JOB_STATE_KEY = 'state'#
IMMIGRATED_KEY = 'imported'#
REMOTE_WORKDIR_KEY = 'remote_workdir'#
RETRIEVE_LIST_KEY = 'retrieve_list'#
RETRIEVE_TEMPORARY_LIST_KEY = 'retrieve_temporary_list'#
SCHEDULER_DETAILED_JOB_INFO_KEY = 'detailed_job_info'#
SCHEDULER_JOB_ID_KEY = 'job_id'#
SCHEDULER_LAST_CHECK_TIME_KEY = 'scheduler_lastchecktime'#
SCHEDULER_LAST_JOB_INFO_KEY = 'last_job_info'#
SCHEDULER_STATE_KEY = 'scheduler_state'#
_CLS_NODE_CACHING#

alias of CalcJobNodeCaching

__abstractmethods__ = frozenset({})#
__annotations__ = {'METADATA_INPUTS_KEY': <class 'str'>, '_CLS_COLLECTION': 'Type[CollectionType]', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__module__ = 'aiida.orm.nodes.process.calculation.calcjob'#
__parameters__ = ()#
__plugin_type_string: ClassVar[str]#
__qb_fields__: Sequence[QbField] = [QbStrField('scheduler_state', dtype=Optional[str], is_attribute=True), QbStrField('state', dtype=Optional[str], is_attribute=True), QbStrField('remote_workdir', dtype=Optional[str], is_attribute=True), QbStrField('job_id', dtype=Optional[str], is_attribute=True), QbStrField('scheduler_lastchecktime', dtype=Optional[str], is_attribute=True), QbStrField('last_job_info', dtype=Optional[str], is_attribute=True), QbDictField('detailed_job_info', dtype=Optional[dict], is_attribute=True), QbArrayField('retrieve_list', dtype=Optional[List[str]], is_attribute=True), QbArrayField('retrieve_temporary_list', dtype=Optional[List[str]], is_attribute=True), QbField('imported', dtype=Optional[bool], is_attribute=True)]#
__query_type_string: ClassVar[str]#
_abc_impl = <_abc._abc_data object>#
_hash_ignored_attributes: Tuple[str, ...] = ('metadata_inputs', 'queue_name', 'account', 'qos', 'priority', 'max_wallclock_seconds', 'max_memory_kb')#
_logger: Logger | None = <Logger aiida.orm.nodes.process.calculation.calcjob.CalcJobNode (WARNING)>#
_tools = None#
_updatable_attributes: Tuple[str, ...] = ('sealed', 'paused', 'checkpoints', 'exception', 'exit_message', 'exit_status', 'process_label', 'process_state', 'process_status', 'state', 'imported', 'remote_workdir', 'retrieve_list', 'retrieve_temporary_list', 'job_id', 'scheduler_state', 'scheduler_lastchecktime', 'last_job_info', 'detailed_job_info')#
static _validate_retrieval_directive(directives: Sequence[str | Tuple[str, str, str]]) None#

Validate a list or tuple of file retrieval directives.

Parameters:

directives – a list or tuple of file retrieval directives

Raises:

ValueError – if the format of the directives is invalid

delete_state() None#

Delete the calculation job state attribute if it exists.

fields: QbFields = {'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'computer_pk': 'QbNumericField(attributes.computer_pk) -> Optional[int]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'detailed_job_info': 'QbDictField(attributes.detailed_job_info) -> '                       'Optional[dict]',  'exception': 'QbStrField(attributes.exception) -> Optional[str]',  'exit_message': 'QbStrField(attributes.exit_message) -> Optional[str]',  'exit_status': 'QbNumericField(attributes.exit_status) -> Optional[int]',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'imported': 'QbField(attributes.imported) -> Optional[bool]',  'job_id': 'QbStrField(attributes.job_id) -> Optional[str]',  'label': 'QbStrField(label) -> str',  'last_job_info': 'QbStrField(attributes.last_job_info) -> Optional[str]',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'paused': 'QbField(attributes.paused) -> bool',  'pk': 'QbNumericField(pk) -> int',  'process_label': 'QbStrField(attributes.process_label) -> Optional[str]',  'process_state': 'QbStrField(attributes.process_state) -> Optional[str]',  'process_status': 'QbStrField(attributes.process_status) -> Optional[str]',  'process_type': 'QbStrField(attributes.process_type) -> Optional[str]',  'remote_workdir': 'QbStrField(attributes.remote_workdir) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'retrieve_list': 'QbArrayField(attributes.retrieve_list) -> '                   'Optional[List[str]]',  'retrieve_temporary_list': 'QbArrayField(attributes.retrieve_temporary_list) '                             '-> Optional[List[str]]',  'scheduler_lastchecktime': 'QbStrField(attributes.scheduler_lastchecktime) -> '                             'Optional[str]',  'scheduler_state': 'QbStrField(attributes.scheduler_state) -> Optional[str]',  'sealed': 'QbField(attributes.sealed) -> bool',  'state': 'QbStrField(attributes.state) -> Optional[str]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
get_authinfo() AuthInfo#

Return the AuthInfo that is configured for the Computer set for this node.

Returns:

AuthInfo

get_description() str#

Return a description of the node based on its properties.

get_detailed_job_info() dict | None#

Return the detailed job info dictionary.

The scheduler is polled for the detailed job info after the job is completed and ready to be retrieved.

Returns:

the dictionary with detailed job info if defined or None

get_job_id() str | None#

Return job id that was assigned to the calculation by the scheduler.

Returns:

the string representation of the scheduler job id

get_last_job_info() JobInfo | None#

Return the last information asked to the scheduler about the status of the job.

The last job info is updated on every poll of the scheduler, except for the final poll when the job drops from the scheduler’s job queue. For completed jobs, the last job info therefore contains the “second-to-last” job info that still shows the job as running. Please use get_detailed_job_info() instead.

Returns:

a JobInfo object (that closely resembles a dictionary) or None.

get_option(name: str) Any | None#

Return the value of an option that was set for this CalcJobNode.

Parameters:

name – the option name

Returns:

the option value or None

Raises:

ValueError for unknown option

get_options() Dict[str, Any]#

Return the dictionary of options set for this CalcJobNode

Returns:

dictionary of the options and their values

get_parser_class() Type[Parser] | None#

Return the output parser object for this calculation or None if no parser is set.

Returns:

a Parser class.

Raises:

aiida.common.exceptions.EntryPointError – if the parser entry point can not be resolved.

get_remote_workdir() str | None#

Return the path to the remote (on cluster) scratch folder of the calculation.

Returns:

a string with the remote path

get_retrieve_list() Sequence[str | Tuple[str, str, str]] | None#

Return the list of files/directories to be retrieved on the cluster after the calculation has completed.

Returns:

a list of file directives

get_retrieve_temporary_list() Sequence[str | Tuple[str, str, str]] | None#

Return list of files to be retrieved from the cluster which will be available during parsing.

Returns:

a list of file directives

get_retrieved_node() FolderData | None#

Return the retrieved data folder.

Returns:

the retrieved FolderData node or None if not found

get_scheduler_lastchecktime() datetime | None#

Return the time of the last update of the scheduler state by the daemon or None if it was never set.

Returns:

a datetime object or None

get_scheduler_state() JobState | None#

Return the status of the calculation according to the cluster scheduler.

Returns:

a JobState enum instance.

get_scheduler_stderr() AnyStr | None#

Return the scheduler stdout output if the calculation has finished and been retrieved, None otherwise.

Returns:

scheduler stdout output or None

get_scheduler_stdout() AnyStr | None#

Return the scheduler stderr output if the calculation has finished and been retrieved, None otherwise.

Returns:

scheduler stderr output or None

get_state() CalcJobState | None#

Return the calculation job active sub state.

The calculation job state serves to give more granular state information to CalcJobs, in addition to the generic process state, while the calculation job is active. The state can take values from the enumeration defined in aiida.common.datastructures.CalcJobState and can be used to query for calculation jobs in specific active states.

Returns:

instance of aiida.common.datastructures.CalcJobState or None if invalid value, or not set

get_transport() Transport#

Return the transport for this calculation.

Returns:

Transport configured with the AuthInfo associated to the computer of this node

property is_imported: bool#

Return whether the calculation job was imported instead of being an actual run.

Return the link label used for the retrieved FolderData node.

property res: CalcJobResultManager#

To be used to get direct access to the parsed parameters.

Returns:

an instance of the CalcJobResultManager.

Note:

a practical example on how it is meant to be used: let’s say that there is a key ‘energy’ in the dictionary of the parsed results which contains a list of floats. The command calc.res.energy will return such a list.

set_detailed_job_info(detailed_job_info: dict | None) None#

Set the detailed job info dictionary.

Parameters:

detailed_job_info – a dictionary with metadata with the accounting of a completed job

set_job_id(job_id: int | str) None#

Set the job id that was assigned to the calculation by the scheduler.

Note

the id will always be stored as a string

Parameters:

job_id – the id assigned by the scheduler after submission

set_last_job_info(last_job_info: JobInfo) None#

Set the last job info.

Parameters:

last_job_info – a JobInfo object

set_option(name: str, value: Any) None#

Set an option to the given value

Parameters:
  • name – the option name

  • value – the value to set

Raises:

ValueError for unknown option

Raises:

TypeError for values with invalid type

set_options(options: Dict[str, Any]) None#

Set the options for this CalcJobNode

Parameters:

options – dictionary of option and their values to set

set_remote_workdir(remote_workdir: str) None#

Set the absolute path to the working directory on the remote computer where the calculation is run.

Parameters:

remote_workdir – absolute filepath to the remote working directory

set_retrieve_list(retrieve_list: Sequence[str | Tuple[str, str, str]]) None#

Set the retrieve list.

This list of directives will instruct the daemon what files to retrieve after the calculation has completed. list or tuple of files or paths that should be retrieved by the daemon.

Parameters:

retrieve_list – list or tuple of with filepath directives

set_retrieve_temporary_list(retrieve_temporary_list: Sequence[str | Tuple[str, str, str]]) None#

Set the retrieve temporary list.

The retrieve temporary list stores files that are retrieved after completion and made available during parsing and are deleted as soon as the parsing has been completed.

Parameters:

retrieve_temporary_list – list or tuple of with filepath directives

set_scheduler_state(state: JobState) None#

Set the scheduler state.

Parameters:

state – an instance of JobState

set_state(state: CalcJobState) None#

Set the calculation active job state.

Raise:

ValueError if state is invalid

property tools: CalculationTools#

Return the calculation tools that are registered for the process type associated with this calculation.

If the entry point name stored in the process_type of the CalcJobNode has an accompanying entry point in the aiida.tools.calculations entry point category, it will attempt to load the entry point and instantiate it passing the node to the constructor. If the entry point does not exist, cannot be resolved or loaded, a warning will be logged and the base CalculationTools class will be instantiated and returned.

Returns:

CalculationTools instance

__annotations__ = {}#
__label__ = 'calcjobs'#
__module__ = 'aiida.restapi.translator.nodes.process.calculation.calcjob'#
_aiida_class#

alias of CalcJobNode

_aiida_type = 'process.calculation.calcjob.CalcJobNode'#
_result_type = 'calcjobs'#
static get_derived_properties(node)[source]#

Generic function extended for calcjob. Currently it is not implemented.

Parameters:

node – node object

Returns:

empty dict

static get_input_files(node, filename)[source]#

Get the submitted input files for job calculation :param node: aiida node :return: the retrieved input files for job calculation

static get_output_files(node, filename)[source]#

Get the retrieved output files for job calculation :param node: aiida node :return: the retrieved output files for job calculation