aiida.orm.nodes.data.code package#

Data plugins that represent an executable code.

Submodules#

Abstract data plugin representing an executable code.

class aiida.orm.nodes.data.code.abstract.AbstractCode(default_calc_job_plugin: str | None = None, append_text: str = '', prepend_text: str = '', use_double_quotes: bool = False, with_mpi: bool | None = None, is_hidden: bool = False, wrap_cmdline_params: bool = False, **kwargs)[source]#

Bases: Data

Abstract data plugin representing an executable code.

class Model(*, label: str, description: str = '', default_calc_job_plugin: str | None = None, use_double_quotes: bool = False, with_mpi: bool | None = None, prepend_text: str = '', append_text: str = '')[source]#

Bases: BaseModel

Model describing required information to create an instance.

__abstractmethods__ = frozenset({})#
__annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'default_calc_job_plugin': 't.Optional[str]', 'description': 'str', 'label': 'str', 'model_computed_fields': 'ClassVar[dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[ConfigDict]', 'model_fields': 'ClassVar[dict[str, FieldInfo]]', 'prepend_text': 'str', 'use_double_quotes': 'bool', 'with_mpi': 't.Optional[bool]'}#
__class_vars__: ClassVar[set[str]] = {}#
__dict__#
__module__ = 'aiida.orm.nodes.data.code.abstract'#
__private_attributes__: ClassVar[dict[str, ModelPrivateAttr]] = {}#
__pydantic_complete__: ClassVar[bool] = True#
__pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model'>, 'config': {'title': 'Model'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model'>), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model'>>]}, 'ref': 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model:94276787011120', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'append_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'default_calc_job_plugin': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method AbstractCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'prepend_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'use_double_quotes': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'with_mpi': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'bool'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Model', 'type': 'model-fields'}, 'type': 'model'}#
__pydantic_custom_init__: ClassVar[bool] = False#
__pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.abstract.AbstractCode.Model:94276787011120', cls_var_name='validate_label_uniqueness', func=<bound method AbstractCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.abstract.AbstractCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('label',), mode='after', check_fields=None))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})#
__pydantic_extra__: dict[str, Any] | None#
__pydantic_fields_set__: set[str]#
__pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
__pydantic_parent_namespace__: ClassVar[dict[str, Any] | None] = {'_KEY_ATTRIBUTE_APPEND_TEXT': 'append_text', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'input_plugin', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'prepend_text', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'use_double_quotes', '_KEY_ATTRIBUTE_WITH_MPI': 'with_mpi', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'wrap_cmdline_params', '_KEY_EXTRA_IS_HIDDEN': 'hidden', '__annotations__': {'_KEY_ATTRIBUTE_APPEND_TEXT': 'str', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'str', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'str', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'str', '_KEY_ATTRIBUTE_WITH_MPI': 'str', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'str', '_KEY_EXTRA_IS_HIDDEN': 'str'}, '__doc__': 'Abstract data plugin representing an executable code.', '__module__': 'aiida.orm.nodes.data.code.abstract', '__qualname__': 'AbstractCode'}#
__pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
__pydantic_private__: dict[str, Any] | None#
__pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model(     ModelSerializer {         class: Py(             0x000055be86667e30,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "use_double_quotes": SerField {                         key_py: Py(                             0x00007f7ff2b354d0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a0f000,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "with_mpi": SerField {                         key_py: Py(                             0x00007f7feacce070,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Bool(                                                 BoolSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "prepend_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "append_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "description": SerField {                         key_py: Py(                             0x00007f7ff5045e30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "default_calc_job_plugin": SerField {                         key_py: Py(                             0x00007f7ff311da70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Str(                                                 StrSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "label": SerField {                         key_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 7,             },         ),         has_extra: false,         root_model: false,         name: "Model",     }, ), definitions=[])#
__pydantic_validator__: ClassVar[SchemaValidator] = SchemaValidator(title="Model", validator=Model(     ModelValidator {         revalidate: Never,         validator: ModelFields(             ModelFieldsValidator {                 fields: [                     Field {                         name: "label",                         lookup_key: Simple {                             key: "label",                             py_key: Py(                                 0x00007f7feacbbc30,                             ),                             path: LookupPath(                                 [                                     S(                                         "label",                                         Py(                                             0x00007f7feacbbbf0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         validator: FunctionAfter(                             FunctionAfterValidator {                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 func: Py(                                     0x00007f7feacb8100,                                 ),                                 config: Py(                                     0x00007f7feacbbb40,                                 ),                                 name: "function-after[validate_label_uniqueness(), str]",                                 field_name: None,                                 info_arg: false,                             },                         ),                         frozen: false,                     },                     Field {                         name: "description",                         lookup_key: Simple {                             key: "description",                             py_key: Py(                                 0x00007f7feacbbbb0,                             ),                             path: LookupPath(                                 [                                     S(                                         "description",                                         Py(                                             0x00007f7feacbbb70,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff5045e30,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "default_calc_job_plugin",                         lookup_key: Simple {                             key: "default_calc_job_plugin",                             py_key: Py(                                 0x00007f7feacca740,                             ),                             path: LookupPath(                                 [                                     S(                                         "default_calc_job_plugin",                                         Py(                                             0x00007f7feacca6f0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff311da70,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a23cc0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Nullable(                                     NullableValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         name: "nullable[str]",                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[nullable[str]]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "use_double_quotes",                         lookup_key: Simple {                             key: "use_double_quotes",                             py_key: Py(                                 0x00007f7feacca790,                             ),                             path: LookupPath(                                 [                                     S(                                         "use_double_quotes",                                         Py(                                             0x00007f7feacca7e0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff2b354d0,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a0f000,                                     ),                                 ),                                 on_error: Raise,                                 validator: Bool(                                     BoolValidator {                                         strict: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[bool]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "with_mpi",                         lookup_key: Simple {                             key: "with_mpi",                             py_key: Py(                                 0x00007f7feacbbc70,                             ),                             path: LookupPath(                                 [                                     S(                                         "with_mpi",                                         Py(                                             0x00007f7feacbbcb0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7feacce070,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a23cc0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Nullable(                                     NullableValidator {                                         validator: Bool(                                             BoolValidator {                                                 strict: false,                                             },                                         ),                                         name: "nullable[bool]",                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[nullable[bool]]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "prepend_text",                         lookup_key: Simple {                             key: "prepend_text",                             py_key: Py(                                 0x00007f7feacbbcf0,                             ),                             path: LookupPath(                                 [                                     S(                                         "prepend_text",                                         Py(                                             0x00007f7feacbbd30,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff31c3d30,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "append_text",                         lookup_key: Simple {                             key: "append_text",                             py_key: Py(                                 0x00007f7feacbbd70,                             ),                             path: LookupPath(                                 [                                     S(                                         "append_text",                                         Py(                                             0x00007f7feacbbdb0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff31c3d70,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                 ],                 model_name: "Model",                 extra_behavior: Ignore,                 extras_validator: None,                 strict: false,                 from_attributes: false,                 loc_by_alias: true,             },         ),         class: Py(             0x000055be86667e30,         ),         post_init: None,         frozen: false,         custom_init: false,         root_model: false,         undefined: Py(             0x00007f7ff21764f0,         ),         name: "Model",     }, ), definitions=[], cache_strings=True)#
__signature__: ClassVar[Signature] = <Signature (*, label: typing.Annotated[str, {'priority': 0}, {'short_name': '-L'}], description: typing.Annotated[str, {'priority': 0}, {'short_name': '-D'}] = '', default_calc_job_plugin: Annotated[Optional[str], {'priority': 0}, {'short_name': '-P'}] = None, use_double_quotes: typing.Annotated[bool, {'priority': 0}] = False, with_mpi: Annotated[Optional[bool], {'priority': 0}] = None, prepend_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', append_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '') -> None>#
__weakref__#

list of weak references to the object (if defined)

_abc_impl = <_abc._abc_data object>#
append_text: str#
default_calc_job_plugin: t.Optional[str]#
description: str#
label: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'append_text': FieldInfo(annotation=str, required=False, default='', title='Append script', description='Bash commands that should be appended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'default_calc_job_plugin': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Default `CalcJob` plugin', description='Entry point name of the default plugin (as listed in `verdi plugin list aiida.calculations`).', metadata=[{'priority': 0}, {'short_name': '-P'}]), 'description': FieldInfo(annotation=str, required=False, default='', title='Description', description='Human-readable description, ideally including version and compilation environment.', metadata=[{'priority': 0}, {'short_name': '-D'}]), 'label': FieldInfo(annotation=str, required=True, title='Label', description='A unique label to identify the code by.', metadata=[{'priority': 0}, {'short_name': '-L'}]), 'prepend_text': FieldInfo(annotation=str, required=False, default='', title='Prepend script', description='Bash commands that should be prepended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'use_double_quotes': FieldInfo(annotation=bool, required=False, default=False, title='Escape using double quotes', description='Whether the executable and arguments of the code in the submission script should be escaped with single or double quotes.', metadata=[{'priority': 0}]), 'with_mpi': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, title='Run with MPI', description='Whether the executable should be run as an MPI program. This option can be left unspecified in which case `None` will be set and it is left up to the calculation job plugin or inputs whether to run with MPI.', metadata=[{'priority': 0}])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

prepend_text: str#
use_double_quotes: bool#
classmethod validate_label_uniqueness(value: str) str[source]#

Validate that the label does not already exist.

with_mpi: t.Optional[bool]#
_KEY_ATTRIBUTE_APPEND_TEXT: str = 'append_text'#
_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN: str = 'input_plugin'#
_KEY_ATTRIBUTE_PREPEND_TEXT: str = 'prepend_text'#
_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES: str = 'use_double_quotes'#
_KEY_ATTRIBUTE_WITH_MPI: str = 'with_mpi'#
_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS: str = 'wrap_cmdline_params'#
_KEY_EXTRA_IS_HIDDEN: str = 'hidden'#
__abstractmethods__ = frozenset({'can_run_on_computer', 'full_label', 'get_executable'})#
__annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_KEY_ATTRIBUTE_APPEND_TEXT': 'str', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'str', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'str', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'str', '_KEY_ATTRIBUTE_WITH_MPI': 'str', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'str', '_KEY_EXTRA_IS_HIDDEN': 'str', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__init__(default_calc_job_plugin: str | None = None, append_text: str = '', prepend_text: str = '', use_double_quotes: bool = False, with_mpi: bool | None = None, is_hidden: bool = False, wrap_cmdline_params: bool = False, **kwargs)[source]#

Construct a new instance.

Parameters:
  • default_calc_job_plugin – The entry point name of the default CalcJob plugin to use.

  • append_text – The text that should be appended to the run line in the job script.

  • prepend_text – The text that should be prepended to the run line in the job script.

  • use_double_quotes – Whether the command line invocation of this code should be escaped with double quotes.

  • with_mpi – Whether the command should be run as an MPI program.

  • wrap_cmdline_params – Whether to wrap the executable and all its command line parameters into quotes to form a single string. This is required to enable support for Docker with the ContainerizedCode.

  • is_hidden – Whether the code is hidden.

__module__ = 'aiida.orm.nodes.data.code.abstract'#
__parameters__ = ()#
_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.data.code.abstract.AbstractCode (WARNING)>#
property append_text: str#

Return the text that should be appended to the run line in the job script.

Returns:

The text that should be appended to the run line in the job script.

abstract can_run_on_computer(computer: Computer) bool[source]#

Return whether the code can run on a given computer.

Parameters:

computer – The computer.

Returns:

True if the code can run on computer, False otherwise.

property default_calc_job_plugin: str | None#

Return the optional default CalcJob plugin.

Returns:

The entry point name of the default CalcJob plugin to use.

fields: QbFields = {'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'label': 'QbStrField(label) -> str',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'pk': 'QbNumericField(pk) -> int',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'source': 'QbDictField(attributes.source.*) -> Optional[dict]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
abstract property full_label: str#

Return the full label of this code.

The full label can be just the label itself but it can be something else. However, it at the very least has to include the label of the code.

Returns:

The full label of the code.

get_builder() ProcessBuilder[source]#

Create and return a new ProcessBuilder for the CalcJob class of the plugin configured for this code.

The configured calculation plugin class is defined by the default_calc_job_plugin property.

Note

it also sets the builder.code value.

Returns:

a ProcessBuilder instance with the code input already populated with ourselves

Raises:
abstract get_executable() PurePosixPath[source]#

Return the executable that the submission script should execute to run the code.

Returns:

The executable to be called in the submission script.

get_executable_cmdline_params(cmdline_params: list[str] | None = None) list[source]#

Return the list of executable with its command line parameters.

Parameters:

cmdline_params – List of command line parameters provided by the CalcJob plugin.

Returns:

List of the executable followed by its command line parameters.

get_prepend_cmdline_params(mpi_args: list[str] | None = None, extra_mpirun_params: list[str] | None = None) list[str][source]#

Return List of command line parameters to be prepended to the executable in submission line. These command line parameters are typically parameters related to MPI invocations.

Parameters:
  • mpi_args – List of MPI parameters provided by the Computer.get_mpirun_command method.

  • extra_mpiruns_params – List of MPI parameters provided by the metadata.options.extra_mpirun_params input of the CalcJob.

Returns:

List of command line parameters to be prepended to the executable in submission line.

property is_hidden: bool#

Return whether the code is hidden.

Returns:

True if the code is hidden, False otherwise, which is also the default.

property label: str#

Return the label.

Returns:

The label.

property prepend_text: str#

Return the text that should be prepended to the run line in the job script.

Returns:

The text that should be prepended to the run line in the job script.

property use_double_quotes: bool#

Return whether the command line invocation of this code should be escaped with double quotes.

Returns:

True if to escape with double quotes, False otherwise.

validate_working_directory(folder: Folder)[source]#

Validate content of the working directory created by the CalcJob plugin.

This method will be called by presubmit() when a new calculation job is launched, passing the Folder that was used by the plugin used for the calculation to create the input files for the working directory. This method can be overridden by implementations of the AbstractCode class that need to validate the contents of that folder.

Parameters:

folder – A sandbox folder that the CalcJob plugin wrote input files to that will be copied to the working directory for the corresponding calculation job instance.

Raises:

PluginInternalError – If the content of the sandbox folder is not valid.

property with_mpi: bool | None#

Return whether the command should be run as an MPI program.

Returns:

True if the code should be run as an MPI program, False if it shouldn’t, None if unknown.

property wrap_cmdline_params: bool#

Return whether all command line parameters should be wrapped with double quotes to form a single argument.

..note:: This is required to support certain containerization technologies, such as Docker.

Returns:

True if command line parameters should be wrapped, False otherwise.

Data plugin representing an executable code inside a container.

The containerized code allows specifying a container image and the executable filepath within that container that is to be executed when a calculation job is run with this code.

class aiida.orm.nodes.data.code.containerized.ContainerizedCode(engine_command: str, image_name: str, **kwargs)[source]#

Bases: InstalledCode

Data plugin representing an executable code in container on a remote computer.

class Model(*, label: str, description: str = '', default_calc_job_plugin: str | None = None, use_double_quotes: bool = False, with_mpi: bool | None = None, prepend_text: str = '', append_text: str = '', computer: str, filepath_executable: str, engine_command: str, image_name: str, wrap_cmdline_params: bool = False)[source]#

Bases: Model

Model describing required information to create an instance.

__abstractmethods__ = frozenset({})#
__annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'computer': 'str', 'default_calc_job_plugin': 't.Optional[str]', 'description': 'str', 'engine_command': 'str', 'filepath_executable': 'str', 'image_name': 'str', 'label': 'str', 'model_computed_fields': 'ClassVar[dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[ConfigDict]', 'model_fields': 'ClassVar[dict[str, FieldInfo]]', 'prepend_text': 'str', 'use_double_quotes': 'bool', 'with_mpi': 't.Optional[bool]', 'wrap_cmdline_params': 'bool'}#
__class_vars__: ClassVar[set[str]] = {}#
__dict__#
__module__ = 'aiida.orm.nodes.data.code.containerized'#
__private_attributes__: ClassVar[dict[str, ModelPrivateAttr]] = {}#
__pydantic_complete__: ClassVar[bool] = True#
__pydantic_core_schema__: ClassVar[CoreSchema] = {'function': {'function': <function InstalledCode.Model.validate_full_label_uniqueness>, 'type': 'no-info'}, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>>]}, 'ref': 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94276787098192', 'schema': {'cls': <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>, 'config': {'title': 'Model'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>)]}, 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'append_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'computer': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method InstalledCode.Model.validate_computer of <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'default_calc_job_plugin': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'engine_command': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'filepath_executable': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'image_name': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method InstalledCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'prepend_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'use_double_quotes': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'with_mpi': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'bool'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'wrap_cmdline_params': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Model', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'function-after'}#
__pydantic_custom_init__: ClassVar[bool] = False#
__pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94276787098192', cls_var_name='validate_label_uniqueness', func=<bound method InstalledCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('label',), mode='after', check_fields=None)), 'validate_computer': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94276787098192', cls_var_name='validate_computer', func=<bound method InstalledCode.Model.validate_computer of <class 'aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('computer',), mode='after', check_fields=None))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={'validate_full_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94276787098192', cls_var_name='validate_full_label_uniqueness', func=<function InstalledCode.Model.validate_full_label_uniqueness>, shim=None, info=ModelValidatorDecoratorInfo(mode='after'))}, computed_fields={})#
__pydantic_extra__: dict[str, Any] | None#
__pydantic_fields_set__: set[str]#
__pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
__pydantic_parent_namespace__: ClassVar[dict[str, Any] | None] = {'_KEY_ATTRIBUTE_ENGINE_COMMAND': 'engine_command', '_KEY_ATTRIBUTE_IMAGE_NAME': 'image_name', '__annotations__': {'_KEY_ATTRIBUTE_ENGINE_COMMAND': 'str', '_KEY_ATTRIBUTE_IMAGE_NAME': 'str'}, '__doc__': 'Data plugin representing an executable code in container on a remote computer.', '__module__': 'aiida.orm.nodes.data.code.containerized', '__qualname__': 'ContainerizedCode'}#
__pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
__pydantic_private__: dict[str, Any] | None#
__pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model(     ModelSerializer {         class: Py(             0x000055be8667d250,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "default_calc_job_plugin": SerField {                         key_py: Py(                             0x00007f7ff311da70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Str(                                                 StrSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "prepend_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "append_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "filepath_executable": SerField {                         key_py: Py(                             0x00007f7feaccafb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "label": SerField {                         key_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "wrap_cmdline_params": SerField {                         key_py: Py(                             0x00007f7feacc8800,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a0f000,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "computer": SerField {                         key_py: Py(                             0x00007f7ff30c9bf0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "with_mpi": SerField {                         key_py: Py(                             0x00007f7feacce070,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Bool(                                                 BoolSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "engine_command": SerField {                         key_py: Py(                             0x00007f7fead64730,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "use_double_quotes": SerField {                         key_py: Py(                             0x00007f7ff2b354d0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a0f000,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "image_name": SerField {                         key_py: Py(                             0x00007f7feaccdf70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "description": SerField {                         key_py: Py(                             0x00007f7ff5045e30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 12,             },         ),         has_extra: false,         root_model: false,         name: "Model",     }, ), definitions=[])#
__pydantic_validator__: ClassVar[SchemaValidator] = SchemaValidator(title="Model", validator=FunctionAfter(     FunctionAfterValidator {         validator: Model(             ModelValidator {                 revalidate: Never,                 validator: ModelFields(                     ModelFieldsValidator {                         fields: [                             Field {                                 name: "label",                                 lookup_key: Simple {                                     key: "label",                                     py_key: Py(                                         0x00007f7fead887f0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "label",                                                 Py(                                                     0x00007f7fead887b0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff4ec3eb0,                                 ),                                 validator: FunctionAfter(                                     FunctionAfterValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         func: Py(                                             0x00007f7fead76400,                                         ),                                         config: Py(                                             0x00007f7fead88700,                                         ),                                         name: "function-after[validate_label_uniqueness(), str]",                                         field_name: None,                                         info_arg: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "description",                                 lookup_key: Simple {                                     key: "description",                                     py_key: Py(                                         0x00007f7fead88770,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "description",                                                 Py(                                                     0x00007f7fead88730,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff5045e30,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "default_calc_job_plugin",                                 lookup_key: Simple {                                     key: "default_calc_job_plugin",                                     py_key: Py(                                         0x00007f7febf83eb0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "default_calc_job_plugin",                                                 Py(                                                     0x00007f7feb045c50,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff311da70,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a23cc0,                                             ),                                         ),                                         on_error: Raise,                                         validator: Nullable(                                             NullableValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: false,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 name: "nullable[str]",                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[nullable[str]]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "use_double_quotes",                                 lookup_key: Simple {                                     key: "use_double_quotes",                                     py_key: Py(                                         0x00007f7feb046790,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "use_double_quotes",                                                 Py(                                                     0x00007f7fead6a830,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff2b354d0,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a0f000,                                             ),                                         ),                                         on_error: Raise,                                         validator: Bool(                                             BoolValidator {                                                 strict: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[bool]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "with_mpi",                                 lookup_key: Simple {                                     key: "with_mpi",                                     py_key: Py(                                         0x00007f7fead88830,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "with_mpi",                                                 Py(                                                     0x00007f7fead88870,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feacce070,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a23cc0,                                             ),                                         ),                                         on_error: Raise,                                         validator: Nullable(                                             NullableValidator {                                                 validator: Bool(                                                     BoolValidator {                                                         strict: false,                                                     },                                                 ),                                                 name: "nullable[bool]",                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[nullable[bool]]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "prepend_text",                                 lookup_key: Simple {                                     key: "prepend_text",                                     py_key: Py(                                         0x00007f7fead888b0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "prepend_text",                                                 Py(                                                     0x00007f7fead888f0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff31c3d30,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "append_text",                                 lookup_key: Simple {                                     key: "append_text",                                     py_key: Py(                                         0x00007f7fead88930,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "append_text",                                                 Py(                                                     0x00007f7fead88970,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff31c3d70,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "computer",                                 lookup_key: Simple {                                     key: "computer",                                     py_key: Py(                                         0x00007f7fead889b0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "computer",                                                 Py(                                                     0x00007f7fead889f0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff30c9bf0,                                 ),                                 validator: FunctionAfter(                                     FunctionAfterValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         func: Py(                                             0x00007f7fead76440,                                         ),                                         config: Py(                                             0x00007f7fead88700,                                         ),                                         name: "function-after[validate_computer(), str]",                                         field_name: None,                                         info_arg: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "filepath_executable",                                 lookup_key: Simple {                                     key: "filepath_executable",                                     py_key: Py(                                         0x00007f7fead6a880,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "filepath_executable",                                                 Py(                                                     0x00007f7fead6a8d0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feaccafb0,                                 ),                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "engine_command",                                 lookup_key: Simple {                                     key: "engine_command",                                     py_key: Py(                                         0x00007f7fead88a30,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "engine_command",                                                 Py(                                                     0x00007f7fead88a70,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7fead64730,                                 ),                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "image_name",                                 lookup_key: Simple {                                     key: "image_name",                                     py_key: Py(                                         0x00007f7fead88ab0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "image_name",                                                 Py(                                                     0x00007f7fead88af0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feaccdf70,                                 ),                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "wrap_cmdline_params",                                 lookup_key: Simple {                                     key: "wrap_cmdline_params",                                     py_key: Py(                                         0x00007f7fead6a920,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "wrap_cmdline_params",                                                 Py(                                                     0x00007f7fead6a970,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feacc8800,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a0f000,                                             ),                                         ),                                         on_error: Raise,                                         validator: Bool(                                             BoolValidator {                                                 strict: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[bool]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                         ],                         model_name: "Model",                         extra_behavior: Ignore,                         extras_validator: None,                         strict: false,                         from_attributes: false,                         loc_by_alias: true,                     },                 ),                 class: Py(                     0x000055be8667d250,                 ),                 post_init: None,                 frozen: false,                 custom_init: false,                 root_model: false,                 undefined: Py(                     0x00007f7ff21764f0,                 ),                 name: "Model",             },         ),         func: Py(             0x00007f7feacbf5b0,         ),         config: Py(             0x00007f7fead76700,         ),         name: "function-after[validate_full_label_uniqueness(), Model]",         field_name: None,         info_arg: false,     }, ), definitions=[], cache_strings=True)#
__signature__: ClassVar[Signature] = <Signature (*, label: typing.Annotated[str, {'priority': 0}, {'short_name': '-L'}], description: typing.Annotated[str, {'priority': 0}, {'short_name': '-D'}] = '', default_calc_job_plugin: Annotated[Optional[str], {'priority': 0}, {'short_name': '-P'}] = None, use_double_quotes: typing.Annotated[bool, {'priority': 0}] = False, with_mpi: Annotated[Optional[bool], {'priority': 0}] = None, prepend_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', append_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', computer: typing.Annotated[str, {'priority': 2}, {'short_name': '-Y'}], filepath_executable: typing.Annotated[str, {'priority': 1}, {'short_name': '-X'}], engine_command: typing.Annotated[str, {'priority': 3}, {'short_name': '-E'}], image_name: typing.Annotated[str, {'priority': 2}, {'short_name': '-I'}], wrap_cmdline_params: typing.Annotated[bool, {'priority': 1}] = False) -> None>#
_abc_impl = <_abc._abc_data object>#
engine_command: str#
image_name: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'append_text': FieldInfo(annotation=str, required=False, default='', title='Append script', description='Bash commands that should be appended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'computer': FieldInfo(annotation=str, required=True, title='Computer', description='The remote computer on which the executable resides.', metadata=[{'priority': 2}, {'short_name': '-Y'}]), 'default_calc_job_plugin': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Default `CalcJob` plugin', description='Entry point name of the default plugin (as listed in `verdi plugin list aiida.calculations`).', metadata=[{'priority': 0}, {'short_name': '-P'}]), 'description': FieldInfo(annotation=str, required=False, default='', title='Description', description='Human-readable description, ideally including version and compilation environment.', metadata=[{'priority': 0}, {'short_name': '-D'}]), 'engine_command': FieldInfo(annotation=str, required=True, title='Engine command', description='The command to run the container. It must contain the placeholder {image_name} that will be replaced with the `image_name`.', metadata=[{'priority': 3}, {'short_name': '-E'}]), 'filepath_executable': FieldInfo(annotation=str, required=True, title='Filepath executable', description='Filepath of the executable on the remote computer.', metadata=[{'priority': 1}, {'short_name': '-X'}]), 'image_name': FieldInfo(annotation=str, required=True, title='Image name', description='Name of the image container in which to the run the executable.', metadata=[{'priority': 2}, {'short_name': '-I'}]), 'label': FieldInfo(annotation=str, required=True, title='Label', description='A unique label to identify the code by.', metadata=[{'priority': 0}, {'short_name': '-L'}]), 'prepend_text': FieldInfo(annotation=str, required=False, default='', title='Prepend script', description='Bash commands that should be prepended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'use_double_quotes': FieldInfo(annotation=bool, required=False, default=False, title='Escape using double quotes', description='Whether the executable and arguments of the code in the submission script should be escaped with single or double quotes.', metadata=[{'priority': 0}]), 'with_mpi': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, title='Run with MPI', description='Whether the executable should be run as an MPI program. This option can be left unspecified in which case `None` will be set and it is left up to the calculation job plugin or inputs whether to run with MPI.', metadata=[{'priority': 0}]), 'wrap_cmdline_params': FieldInfo(annotation=bool, required=False, default=False, title='Wrap command line parameters', description='Whether all command line parameters to be passed to the engine command should be wrapped in a double quotes to form a single argument. This should be set to `True` for Docker.', metadata=[{'priority': 1}])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

wrap_cmdline_params: bool#
_KEY_ATTRIBUTE_ENGINE_COMMAND: str = 'engine_command'#
_KEY_ATTRIBUTE_IMAGE_NAME: str = 'image_name'#
__abstractmethods__ = frozenset({})#
__annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_KEY_ATTRIBUTE_APPEND_TEXT': 'str', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'str', '_KEY_ATTRIBUTE_ENGINE_COMMAND': 'str', '_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'str', '_KEY_ATTRIBUTE_IMAGE_NAME': 'str', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'str', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'str', '_KEY_ATTRIBUTE_WITH_MPI': 'str', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'str', '_KEY_EXTRA_IS_HIDDEN': 'str', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__init__(engine_command: str, image_name: str, **kwargs)[source]#

Construct a new instance.

Parameters:
  • computer – The remote computer on which the executable is located.

  • filepath_executable – The absolute filepath of the executable on the remote computer.

__module__ = 'aiida.orm.nodes.data.code.containerized'#
__parameters__ = ()#
_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.data.code.containerized.ContainerizedCode (WARNING)>#
property engine_command: str#

Return the engine command with image as template field of the containerized code.

Returns:

The engine command of the containerized code

fields: QbFields = {'append_text': 'QbStrField(attributes.append_text) -> Optional[str]',  'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'input_plugin': 'QbStrField(attributes.input_plugin) -> Optional[str]',  'is_local': 'QbField(attributes.is_local) -> Optional[bool]',  'label': 'QbStrField(label) -> str',  'local_executable': 'QbStrField(attributes.local_executable) -> Optional[str]',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'pk': 'QbNumericField(pk) -> int',  'prepend_text': 'QbStrField(attributes.prepend_text) -> Optional[str]',  'remote_exec_path': 'QbStrField(attributes.remote_exec_path) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'source': 'QbDictField(attributes.source.*) -> Optional[dict]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
property filepath_executable: PurePosixPath#

Return the filepath of the executable that this code represents.

Note

This is overridden from the base class since the path does not have to be absolute.

Returns:

The filepath of the executable.

get_prepend_cmdline_params(mpi_args: list[str] | None = None, extra_mpirun_params: list[str] | None = None) list[str][source]#

Return the list of prepend cmdline params for mpi seeting

Returns:

list of prepend cmdline parameters.

property image_name: str#

The image name of container.

Returns:

The image name of container.

Data plugin representing an executable code on a remote computer.

This plugin should be used if an executable is pre-installed on a computer. The InstalledCode represents the code by storing the absolute filepath of the relevant executable and the computer on which it is installed. The computer is represented by an instance of aiida.orm.computers.Computer. Each time a aiida.engine.CalcJob is run using an InstalledCode, it will run its executable on the associated computer.

class aiida.orm.nodes.data.code.installed.InstalledCode(computer: Computer, filepath_executable: str, **kwargs)[source]#

Bases: Code

Data plugin representing an executable code on a remote computer.

class Model(*, label: str, description: str = '', default_calc_job_plugin: str | None = None, use_double_quotes: bool = False, with_mpi: bool | None = None, prepend_text: str = '', append_text: str = '', computer: str, filepath_executable: str)[source]#

Bases: Model

Model describing required information to create an instance.

__abstractmethods__ = frozenset({})#
__annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'computer': 'str', 'default_calc_job_plugin': 't.Optional[str]', 'description': 'str', 'filepath_executable': 'str', 'label': 'str', 'model_computed_fields': 'ClassVar[dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[ConfigDict]', 'model_fields': 'ClassVar[dict[str, FieldInfo]]', 'prepend_text': 'str', 'use_double_quotes': 'bool', 'with_mpi': 't.Optional[bool]'}#
__class_vars__: ClassVar[set[str]] = {}#
__dict__#
__module__ = 'aiida.orm.nodes.data.code.installed'#
__private_attributes__: ClassVar[dict[str, ModelPrivateAttr]] = {}#
__pydantic_complete__: ClassVar[bool] = True#
__pydantic_core_schema__: ClassVar[CoreSchema] = {'function': {'function': <function InstalledCode.Model.validate_full_label_uniqueness>, 'type': 'no-info'}, 'metadata': {'pydantic_js_functions': [<bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>>]}, 'ref': 'aiida.orm.nodes.data.code.installed.InstalledCode.Model:94276787073072', 'schema': {'cls': <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>, 'config': {'title': 'Model'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>)]}, 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'append_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'computer': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method InstalledCode.Model.validate_computer of <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'default_calc_job_plugin': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'filepath_executable': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method InstalledCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'prepend_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'use_double_quotes': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'with_mpi': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'bool'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Model', 'type': 'model-fields'}, 'type': 'model'}, 'type': 'function-after'}#
__pydantic_custom_init__: ClassVar[bool] = False#
__pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94276787073072', cls_var_name='validate_label_uniqueness', func=<bound method InstalledCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('label',), mode='after', check_fields=None)), 'validate_computer': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94276787073072', cls_var_name='validate_computer', func=<bound method InstalledCode.Model.validate_computer of <class 'aiida.orm.nodes.data.code.installed.InstalledCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('computer',), mode='after', check_fields=None))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={'validate_full_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94276787073072', cls_var_name='validate_full_label_uniqueness', func=<function InstalledCode.Model.validate_full_label_uniqueness>, shim=None, info=ModelValidatorDecoratorInfo(mode='after'))}, computed_fields={})#
__pydantic_extra__: dict[str, Any] | None#
__pydantic_fields_set__: set[str]#
__pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
__pydantic_parent_namespace__: ClassVar[dict[str, Any] | None] = {'_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'filepath_executable', '__annotations__': {'_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'str'}, '__doc__': 'Data plugin representing an executable code on a remote computer.', '__module__': 'aiida.orm.nodes.data.code.installed', '__qualname__': 'InstalledCode'}#
__pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
__pydantic_private__: dict[str, Any] | None#
__pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model(     ModelSerializer {         class: Py(             0x000055be86677030,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "append_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "computer": SerField {                         key_py: Py(                             0x00007f7ff30c9bf0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "prepend_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "description": SerField {                         key_py: Py(                             0x00007f7ff5045e30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "label": SerField {                         key_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "filepath_executable": SerField {                         key_py: Py(                             0x00007f7feaccafb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "default_calc_job_plugin": SerField {                         key_py: Py(                             0x00007f7ff311da70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Str(                                                 StrSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "use_double_quotes": SerField {                         key_py: Py(                             0x00007f7ff2b354d0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a0f000,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "with_mpi": SerField {                         key_py: Py(                             0x00007f7feacce070,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Bool(                                                 BoolSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 9,             },         ),         has_extra: false,         root_model: false,         name: "Model",     }, ), definitions=[])#
__pydantic_validator__: ClassVar[SchemaValidator] = SchemaValidator(title="Model", validator=FunctionAfter(     FunctionAfterValidator {         validator: Model(             ModelValidator {                 revalidate: Never,                 validator: ModelFields(                     ModelFieldsValidator {                         fields: [                             Field {                                 name: "label",                                 lookup_key: Simple {                                     key: "label",                                     py_key: Py(                                         0x00007f7fead75a70,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "label",                                                 Py(                                                     0x00007f7fead75a30,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff4ec3eb0,                                 ),                                 validator: FunctionAfter(                                     FunctionAfterValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         func: Py(                                             0x00007f7fead67080,                                         ),                                         config: Py(                                             0x00007f7fead75980,                                         ),                                         name: "function-after[validate_label_uniqueness(), str]",                                         field_name: None,                                         info_arg: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "description",                                 lookup_key: Simple {                                     key: "description",                                     py_key: Py(                                         0x00007f7fead759f0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "description",                                                 Py(                                                     0x00007f7fead759b0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff5045e30,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "default_calc_job_plugin",                                 lookup_key: Simple {                                     key: "default_calc_job_plugin",                                     py_key: Py(                                         0x00007f7fead6a150,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "default_calc_job_plugin",                                                 Py(                                                     0x00007f7fead6a1a0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff311da70,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a23cc0,                                             ),                                         ),                                         on_error: Raise,                                         validator: Nullable(                                             NullableValidator {                                                 validator: Str(                                                     StrValidator {                                                         strict: false,                                                         coerce_numbers_to_str: false,                                                     },                                                 ),                                                 name: "nullable[str]",                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[nullable[str]]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "use_double_quotes",                                 lookup_key: Simple {                                     key: "use_double_quotes",                                     py_key: Py(                                         0x00007f7fead6a100,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "use_double_quotes",                                                 Py(                                                     0x00007f7fead6a1f0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff2b354d0,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a0f000,                                             ),                                         ),                                         on_error: Raise,                                         validator: Bool(                                             BoolValidator {                                                 strict: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[bool]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "with_mpi",                                 lookup_key: Simple {                                     key: "with_mpi",                                     py_key: Py(                                         0x00007f7fead75ab0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "with_mpi",                                                 Py(                                                     0x00007f7fead75af0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feacce070,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5a23cc0,                                             ),                                         ),                                         on_error: Raise,                                         validator: Nullable(                                             NullableValidator {                                                 validator: Bool(                                                     BoolValidator {                                                         strict: false,                                                     },                                                 ),                                                 name: "nullable[bool]",                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[nullable[bool]]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "prepend_text",                                 lookup_key: Simple {                                     key: "prepend_text",                                     py_key: Py(                                         0x00007f7fead75b30,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "prepend_text",                                                 Py(                                                     0x00007f7fead75b70,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff31c3d30,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "append_text",                                 lookup_key: Simple {                                     key: "append_text",                                     py_key: Py(                                         0x00007f7fead75bb0,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "append_text",                                                 Py(                                                     0x00007f7fead75bf0,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff31c3d70,                                 ),                                 validator: WithDefault(                                     WithDefaultValidator {                                         default: Default(                                             Py(                                                 0x00007f7ff5220030,                                             ),                                         ),                                         on_error: Raise,                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         validate_default: false,                                         copy_default: false,                                         name: "default[str]",                                         undefined: Py(                                             0x00007f7ff21764f0,                                         ),                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "computer",                                 lookup_key: Simple {                                     key: "computer",                                     py_key: Py(                                         0x00007f7fead75c30,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "computer",                                                 Py(                                                     0x00007f7fead75c70,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7ff30c9bf0,                                 ),                                 validator: FunctionAfter(                                     FunctionAfterValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         func: Py(                                             0x00007f7fead67040,                                         ),                                         config: Py(                                             0x00007f7fead75980,                                         ),                                         name: "function-after[validate_computer(), str]",                                         field_name: None,                                         info_arg: false,                                     },                                 ),                                 frozen: false,                             },                             Field {                                 name: "filepath_executable",                                 lookup_key: Simple {                                     key: "filepath_executable",                                     py_key: Py(                                         0x00007f7fead6a240,                                     ),                                     path: LookupPath(                                         [                                             S(                                                 "filepath_executable",                                                 Py(                                                     0x00007f7fead6a290,                                                 ),                                             ),                                         ],                                     ),                                 },                                 name_py: Py(                                     0x00007f7feaccafb0,                                 ),                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 frozen: false,                             },                         ],                         model_name: "Model",                         extra_behavior: Ignore,                         extras_validator: None,                         strict: false,                         from_attributes: false,                         loc_by_alias: true,                     },                 ),                 class: Py(                     0x000055be86677030,                 ),                 post_init: None,                 frozen: false,                 custom_init: false,                 root_model: false,                 undefined: Py(                     0x00007f7ff21764f0,                 ),                 name: "Model",             },         ),         func: Py(             0x00007f7feacbf5b0,         ),         config: Py(             0x00007f7fead673c0,         ),         name: "function-after[validate_full_label_uniqueness(), Model]",         field_name: None,         info_arg: false,     }, ), definitions=[], cache_strings=True)#
__signature__: ClassVar[Signature] = <Signature (*, label: typing.Annotated[str, {'priority': 0}, {'short_name': '-L'}], description: typing.Annotated[str, {'priority': 0}, {'short_name': '-D'}] = '', default_calc_job_plugin: Annotated[Optional[str], {'priority': 0}, {'short_name': '-P'}] = None, use_double_quotes: typing.Annotated[bool, {'priority': 0}] = False, with_mpi: Annotated[Optional[bool], {'priority': 0}] = None, prepend_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', append_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', computer: typing.Annotated[str, {'priority': 2}, {'short_name': '-Y'}], filepath_executable: typing.Annotated[str, {'priority': 1}, {'short_name': '-X'}]) -> None>#
_abc_impl = <_abc._abc_data object>#
computer: str#
filepath_executable: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'append_text': FieldInfo(annotation=str, required=False, default='', title='Append script', description='Bash commands that should be appended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'computer': FieldInfo(annotation=str, required=True, title='Computer', description='The remote computer on which the executable resides.', metadata=[{'priority': 2}, {'short_name': '-Y'}]), 'default_calc_job_plugin': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Default `CalcJob` plugin', description='Entry point name of the default plugin (as listed in `verdi plugin list aiida.calculations`).', metadata=[{'priority': 0}, {'short_name': '-P'}]), 'description': FieldInfo(annotation=str, required=False, default='', title='Description', description='Human-readable description, ideally including version and compilation environment.', metadata=[{'priority': 0}, {'short_name': '-D'}]), 'filepath_executable': FieldInfo(annotation=str, required=True, title='Filepath executable', description='Filepath of the executable on the remote computer.', metadata=[{'priority': 1}, {'short_name': '-X'}]), 'label': FieldInfo(annotation=str, required=True, title='Label', description='A unique label to identify the code by.', metadata=[{'priority': 0}, {'short_name': '-L'}]), 'prepend_text': FieldInfo(annotation=str, required=False, default='', title='Prepend script', description='Bash commands that should be prepended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'use_double_quotes': FieldInfo(annotation=bool, required=False, default=False, title='Escape using double quotes', description='Whether the executable and arguments of the code in the submission script should be escaped with single or double quotes.', metadata=[{'priority': 0}]), 'with_mpi': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, title='Run with MPI', description='Whether the executable should be run as an MPI program. This option can be left unspecified in which case `None` will be set and it is left up to the calculation job plugin or inputs whether to run with MPI.', metadata=[{'priority': 0}])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod validate_computer(value: str) Computer[source]#

Override the validator for the label of the base class since uniqueness is defined on full label.

validate_full_label_uniqueness() Model[source]#

Validate that the full label does not already exist.

classmethod validate_label_uniqueness(value: str) str[source]#

Override the validator for the label of the base class since uniqueness is defined on full label.

_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE: str = 'filepath_executable'#
__abstractmethods__ = frozenset({})#
__annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_KEY_ATTRIBUTE_APPEND_TEXT': 'str', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'str', '_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'str', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'str', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'str', '_KEY_ATTRIBUTE_WITH_MPI': 'str', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'str', '_KEY_EXTRA_IS_HIDDEN': 'str', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__init__(computer: Computer, filepath_executable: str, **kwargs)[source]#

Construct a new instance.

Parameters:
  • computer – The remote computer on which the executable is located.

  • filepath_executable – The absolute filepath of the executable on the remote computer.

__module__ = 'aiida.orm.nodes.data.code.installed'#
__parameters__ = ()#
_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.data.code.installed.InstalledCode (WARNING)>#
_validate()[source]#

Validate the instance by checking that a computer has been defined.

:raises aiida.common.exceptions.ValidationError: If the state of the node is invalid.

can_run_on_computer(computer: Computer) bool[source]#

Return whether the code can run on a given computer.

Parameters:

computer – The computer.

Returns:

True if the provided computer is the same as the one configured for this code.

property computer: Computer#

Return the computer of this code.

fields: QbFields = {'append_text': 'QbStrField(attributes.append_text) -> Optional[str]',  'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'input_plugin': 'QbStrField(attributes.input_plugin) -> Optional[str]',  'is_local': 'QbField(attributes.is_local) -> Optional[bool]',  'label': 'QbStrField(label) -> str',  'local_executable': 'QbStrField(attributes.local_executable) -> Optional[str]',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'pk': 'QbNumericField(pk) -> int',  'prepend_text': 'QbStrField(attributes.prepend_text) -> Optional[str]',  'remote_exec_path': 'QbStrField(attributes.remote_exec_path) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'source': 'QbDictField(attributes.source.*) -> Optional[dict]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
property filepath_executable: PurePosixPath#

Return the absolute filepath of the executable that this code represents.

Returns:

The absolute filepath of the executable.

property full_label: str#

Return the full label of this code.

The full label can be just the label itself but it can be something else. However, it at the very least has to include the label of the code.

Returns:

The full label of the code.

get_executable() PurePosixPath[source]#

Return the executable that the submission script should execute to run the code.

Returns:

The executable to be called in the submission script.

validate_filepath_executable()[source]#

Validate the filepath_executable attribute.

Checks whether the executable exists on the remote computer if a transport can be opened to it. This method is intentionally not called in _validate as to allow the creation of Code instances whose computers can not yet be connected to and as to not require the overhead of opening transports in storing a new code.

Note

If the filepath_executable is not an absolute path, the check is skipped.

Raises:

ValidationError – if no transport could be opened or if the defined executable does not exist on the remote computer.

Data plugin represeting an executable code to be wrapped and called through a CalcJob plugin.

class aiida.orm.nodes.data.code.legacy.Code(remote_computer_exec=None, local_executable=None, input_plugin_name=None, files=None, **kwargs)[source]#

Bases: AbstractCode

A code entity. It can either be ‘local’, or ‘remote’.

  • Local code: it is a collection of files/dirs (added using the add_path() method), where one file is flagged as executable (using the set_local_executable() method).

  • Remote code: it is a pair (remotecomputer, remotepath_of_executable) set using the set_remote_computer_exec() method.

For both codes, one can set some code to be executed right before or right after the execution of the code, using the set_preexec_code() and set_postexec_code() methods (e.g., the set_preexec_code() can be used to load specific modules required for the code to be run).

HIDDEN_KEY = 'hidden'#
__abstractmethods__ = frozenset({})#
__init__(remote_computer_exec=None, local_executable=None, input_plugin_name=None, files=None, **kwargs)[source]#

Construct a new instance.

Parameters:
  • default_calc_job_plugin – The entry point name of the default CalcJob plugin to use.

  • append_text – The text that should be appended to the run line in the job script.

  • prepend_text – The text that should be prepended to the run line in the job script.

  • use_double_quotes – Whether the command line invocation of this code should be escaped with double quotes.

  • with_mpi – Whether the command should be run as an MPI program.

  • wrap_cmdline_params – Whether to wrap the executable and all its command line parameters into quotes to form a single string. This is required to enable support for Docker with the ContainerizedCode.

  • is_hidden – Whether the code is hidden.

__module__ = 'aiida.orm.nodes.data.code.legacy'#
__parameters__ = ()#
__plugin_type_string: ClassVar[str]#
__qb_fields__: Sequence[QbField] = [QbStrField('prepend_text', dtype=Optional[str], is_attribute=True), QbStrField('append_text', dtype=Optional[str], is_attribute=True), QbStrField('input_plugin', dtype=Optional[str], is_attribute=True), QbStrField('local_executable', dtype=Optional[str], is_attribute=True), QbStrField('remote_exec_path', dtype=Optional[str], is_attribute=True), QbField('is_local', dtype=Optional[bool], is_attribute=True)]#
__query_type_string: ClassVar[str]#
__str__()[source]#

Return str(self).

_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.data.code.legacy.Code (WARNING)>#
_set_local()[source]#

Set the code as a ‘local’ code, meaning that all the files belonging to the code will be copied to the cluster, and the file set with set_exec_filename will be run.

It also deletes the flags related to the local case (if any)

_set_remote()[source]#

Set the code as a ‘remote’ code, meaning that the code itself has no files attached, but only a location on a remote computer (with an absolute path of the executable on the remote computer).

It also deletes the flags related to the local case (if any)

_validate()[source]#

Validate information stored in Node object.

For the Node base class, this check is always valid. Subclasses can override this method to perform additional checks and should usually call super()._validate() first!

This method is called automatically before storing the node in the DB. Therefore, use get() and similar methods that automatically read either from the DB or from the internal attribute cache.

can_run_on(computer)[source]#

Return True if this code can run on the given computer, False otherwise.

Local codes can run on any machine; remote codes can run only on the machine on which they reside.

TODO: add filters to mask the remote machines on which a local code can run.

can_run_on_computer(computer: Computer) bool[source]#

Return whether the code can run on a given computer.

Parameters:

computer – The computer.

Returns:

True if the code can run on computer, False otherwise.

fields: QbFields = {'append_text': 'QbStrField(attributes.append_text) -> Optional[str]',  'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'input_plugin': 'QbStrField(attributes.input_plugin) -> Optional[str]',  'is_local': 'QbField(attributes.is_local) -> Optional[bool]',  'label': 'QbStrField(label) -> str',  'local_executable': 'QbStrField(attributes.local_executable) -> Optional[str]',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'pk': 'QbNumericField(pk) -> int',  'prepend_text': 'QbStrField(attributes.prepend_text) -> Optional[str]',  'remote_exec_path': 'QbStrField(attributes.remote_exec_path) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'source': 'QbDictField(attributes.source.*) -> Optional[dict]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
property full_label#

Get full label of this code.

Returns label of the form <code-label>@<computer-name>.

classmethod get(pk=None, label=None, machinename=None)[source]#

Get a Computer object with given identifier string, that can either be the numeric ID (pk), or the label (and computername) (if unique).

Parameters:
  • pk – the numeric ID (pk) for code

  • label – the code label identifying the code to load

  • machinename – the machine name where code is setup

Raises:
get_append_text()[source]#

Return the postexec_code, or an empty string if no post-exec code was defined.

classmethod get_code_helper(label, machinename=None, backend=None)[source]#
Parameters:
  • label – the code label identifying the code to load

  • machinename – the machine name where code is setup

Raises:
get_computer_label()[source]#

Get label of this code’s computer.

get_description()[source]#

Return a string description of this Code instance.

Returns:

string description of this Code instance

get_execname()[source]#

Return the executable string to be put in the script. For local codes, it is ./LOCAL_EXECUTABLE_NAME For remote codes, it is the absolute path to the executable.

get_executable() PurePosixPath[source]#

Return the executable that the submission script should execute to run the code.

Returns:

The executable to be called in the submission script.

classmethod get_from_string(code_string)[source]#

Get a Computer object with given identifier string in the format label@machinename. See the note below for details on the string detection algorithm.

Note

the (leftmost) ‘@’ symbol is always used to split code and computername. Therefore do not use ‘@’ in the code name if you want to use this function (‘@’ in the computer name are instead valid).

Parameters:

code_string – the code string identifying the code to load

Raises:
get_input_plugin_name()[source]#

Return the name of the default input plugin (or None if no input plugin was set.

get_local_executable()[source]#

Return the local executable.

get_prepend_text() str[source]#

Return the code that will be put in the scheduler script before the execution, or an empty string if no pre-exec code was defined.

get_remote_computer()[source]#

Return the remote computer associated with this code.

get_remote_exec_path()[source]#

Return the remote_exec_path attribute.

get_use_double_quotes() bool[source]#

Return whether the command line invocation of this code should be escaped with double quotes.

Returns:

True if to escape with double quotes, False otherwise which is also the default.

property hidden#

Determines whether the Code is hidden or not

hide()[source]#

Hide the code (prevents from showing it in the verdi code list)

is_local()[source]#

Return True if the code is ‘local’, False if it is ‘remote’ (see also documentation of the set_local and set_remote functions).

classmethod list_for_plugin(plugin, labels=True, backend=None)[source]#

Return a list of valid code strings for a given plugin.

Parameters:
  • plugin – The string of the plugin.

  • labels – if True, return a list of code names, otherwise return the code PKs (integers).

Returns:

a list of string, with the code names if labels is True, otherwise a list of integers with the code PKs.

relabel(new_label)[source]#

Relabel this code.

Parameters:

new_label – new code label

reveal()[source]#

Reveal the code (allows to show it in the verdi code list) By default, it is revealed

set_append_text(code)[source]#

Pass a string of code that will be put in the scheduler script after the execution of the code.

set_files(files)[source]#

Given a list of filenames (or a single filename string), add it to the path (all at level zero, i.e. without folders). Therefore, be careful for files with the same name!

Todo:

decide whether to check if the Code must be a local executable to be able to call this function.

set_input_plugin_name(input_plugin)[source]#

Set the name of the default input plugin, to be used for the automatic generation of a new calculation.

set_local_executable(exec_name)[source]#

Set the filename of the local executable. Implicitly set the code as local.

set_prepend_text(code)[source]#

Pass a string of code that will be put in the scheduler script before the execution of the code.

set_remote_computer_exec(remote_computer_exec)[source]#

Set the code as remote, and pass the computer on which it resides and the absolute path on that computer.

Parameters:

remote_computer_exec – a tuple (computer, remote_exec_path), where computer is a aiida.orm.Computer and remote_exec_path is the absolute path of the main executable on remote computer.

set_use_double_quotes(use_double_quotes: bool)[source]#

Set whether the command line invocation of this code should be escaped with double quotes.

Parameters:

use_double_quotes – True if to escape with double quotes, False otherwise.

validate_remote_exec_path()[source]#

Validate the remote_exec_path attribute.

Checks whether the executable exists on the remote computer if a transport can be opened to it. This method is intentionally not called in _validate as to allow the creation of Code instances whose computers can not yet be connected to and as to not require the overhead of opening transports in storing a new code.

Raises:

ValidationError – if no transport could be opened or if the defined executable does not exist on the remote computer.

Data plugin representing an executable code stored in AiiDA’s storage.

This plugin should be used for executables that are not already installed on the target computer, but instead are available on the machine where AiiDA is running. The plugin assumes that the code is self-contained by a single directory containing all the necessary files, including a main executable. When constructing a PortableCode, passing the absolute filepath as filepath_files will make sure that all the files contained within are uploaded to AiiDA’s storage. The filepath_executable should indicate the filename of the executable within that directory. Each time a aiida.engine.CalcJob is run using a PortableCode, the uploaded files will be automatically copied to the working directory on the selected computer and the executable will be run there.

class aiida.orm.nodes.data.code.portable.PortableCode(filepath_executable: str, filepath_files: Path, **kwargs)[source]#

Bases: Code

Data plugin representing an executable code stored in AiiDA’s storage.

class Model(*, label: str, description: str = '', default_calc_job_plugin: str | None = None, use_double_quotes: bool = False, with_mpi: bool | None = None, prepend_text: str = '', append_text: str = '', filepath_files: str, filepath_executable: str)[source]#

Bases: Model

Model describing required information to create an instance.

__abstractmethods__ = frozenset({})#
__annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'default_calc_job_plugin': 't.Optional[str]', 'description': 'str', 'filepath_executable': 'str', 'filepath_files': 'str', 'label': 'str', 'model_computed_fields': 'ClassVar[dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[ConfigDict]', 'model_fields': 'ClassVar[dict[str, FieldInfo]]', 'prepend_text': 'str', 'use_double_quotes': 'bool', 'with_mpi': 't.Optional[bool]'}#
__class_vars__: ClassVar[set[str]] = {}#
__dict__#
__module__ = 'aiida.orm.nodes.data.code.portable'#
__private_attributes__: ClassVar[dict[str, ModelPrivateAttr]] = {}#
__pydantic_complete__: ClassVar[bool] = True#
__pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>, 'config': {'title': 'Model'}, 'custom_init': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>>]}, 'ref': 'aiida.orm.nodes.data.code.portable.PortableCode.Model:94276787127808', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'append_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'default_calc_job_plugin': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'str'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}, 'description': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'filepath_executable': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'type': 'str'}, 'type': 'model-field'}, 'filepath_files': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method PortableCode.Model.validate_filepath_files of <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'label': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'function': {'function': <bound method AbstractCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'type': 'model-field'}, 'prepend_text': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'use_double_quotes': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'with_mpi': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': None, 'schema': {'schema': {'type': 'bool'}, 'type': 'nullable'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'Model', 'type': 'model-fields'}, 'type': 'model'}#
__pydantic_custom_init__: ClassVar[bool] = False#
__pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.portable.PortableCode.Model:94276787127808', cls_var_name='validate_label_uniqueness', func=<bound method AbstractCode.Model.validate_label_uniqueness of <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('label',), mode='after', check_fields=None)), 'validate_filepath_files': Decorator(cls_ref='aiida.orm.nodes.data.code.portable.PortableCode.Model:94276787127808', cls_var_name='validate_filepath_files', func=<bound method PortableCode.Model.validate_filepath_files of <class 'aiida.orm.nodes.data.code.portable.PortableCode.Model'>>, shim=None, info=FieldValidatorDecoratorInfo(fields=('filepath_files',), mode='after', check_fields=None))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})#
__pydantic_extra__: dict[str, Any] | None#
__pydantic_fields_set__: set[str]#
__pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
__pydantic_parent_namespace__: ClassVar[dict[str, Any] | None] = {'_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'filepath_executable', '__annotations__': {'_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'str'}, '__doc__': "Data plugin representing an executable code stored in AiiDA's storage.", '__module__': 'aiida.orm.nodes.data.code.portable', '__qualname__': 'PortableCode'}#
__pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
__pydantic_private__: dict[str, Any] | None#
__pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model(     ModelSerializer {         class: Py(             0x000055be86684600,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "default_calc_job_plugin": SerField {                         key_py: Py(                             0x00007f7ff311da70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Str(                                                 StrSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                     "filepath_executable": SerField {                         key_py: Py(                             0x00007f7feaccafb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "filepath_files": SerField {                         key_py: Py(                             0x00007f7fead89070,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "description": SerField {                         key_py: Py(                             0x00007f7ff5045e30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "prepend_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "label": SerField {                         key_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             Str(                                 StrSerializer,                             ),                         ),                         required: true,                     },                     "use_double_quotes": SerField {                         key_py: Py(                             0x00007f7ff2b354d0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a0f000,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "append_text": SerField {                         key_py: Py(                             0x00007f7ff31c3d70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5220030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "with_mpi": SerField {                         key_py: Py(                             0x00007f7feacce070,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f7ff5a23cc0,                                         ),                                     ),                                     serializer: Nullable(                                         NullableSerializer {                                             serializer: Bool(                                                 BoolSerializer,                                             ),                                         },                                     ),                                 },                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 9,             },         ),         has_extra: false,         root_model: false,         name: "Model",     }, ), definitions=[])#
__pydantic_validator__: ClassVar[SchemaValidator] = SchemaValidator(title="Model", validator=Model(     ModelValidator {         revalidate: Never,         validator: ModelFields(             ModelFieldsValidator {                 fields: [                     Field {                         name: "label",                         lookup_key: Simple {                             key: "label",                             py_key: Py(                                 0x00007f7fead8bd30,                             ),                             path: LookupPath(                                 [                                     S(                                         "label",                                         Py(                                             0x00007f7fead8bcf0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff4ec3eb0,                         ),                         validator: FunctionAfter(                             FunctionAfterValidator {                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 func: Py(                                     0x00007f7fead89b00,                                 ),                                 config: Py(                                     0x00007f7fead8bc40,                                 ),                                 name: "function-after[validate_label_uniqueness(), str]",                                 field_name: None,                                 info_arg: false,                             },                         ),                         frozen: false,                     },                     Field {                         name: "description",                         lookup_key: Simple {                             key: "description",                             py_key: Py(                                 0x00007f7fead8bcb0,                             ),                             path: LookupPath(                                 [                                     S(                                         "description",                                         Py(                                             0x00007f7fead8bc70,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff5045e30,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "default_calc_job_plugin",                         lookup_key: Simple {                             key: "default_calc_job_plugin",                             py_key: Py(                                 0x00007f7fead6b910,                             ),                             path: LookupPath(                                 [                                     S(                                         "default_calc_job_plugin",                                         Py(                                             0x00007f7fead6b960,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff311da70,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a23cc0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Nullable(                                     NullableValidator {                                         validator: Str(                                             StrValidator {                                                 strict: false,                                                 coerce_numbers_to_str: false,                                             },                                         ),                                         name: "nullable[str]",                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[nullable[str]]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "use_double_quotes",                         lookup_key: Simple {                             key: "use_double_quotes",                             py_key: Py(                                 0x00007f7fead6b870,                             ),                             path: LookupPath(                                 [                                     S(                                         "use_double_quotes",                                         Py(                                             0x00007f7fead6b9b0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff2b354d0,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a0f000,                                     ),                                 ),                                 on_error: Raise,                                 validator: Bool(                                     BoolValidator {                                         strict: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[bool]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "with_mpi",                         lookup_key: Simple {                             key: "with_mpi",                             py_key: Py(                                 0x00007f7fead8bd70,                             ),                             path: LookupPath(                                 [                                     S(                                         "with_mpi",                                         Py(                                             0x00007f7fead8bdb0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7feacce070,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5a23cc0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Nullable(                                     NullableValidator {                                         validator: Bool(                                             BoolValidator {                                                 strict: false,                                             },                                         ),                                         name: "nullable[bool]",                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[nullable[bool]]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "prepend_text",                         lookup_key: Simple {                             key: "prepend_text",                             py_key: Py(                                 0x00007f7fead8bdf0,                             ),                             path: LookupPath(                                 [                                     S(                                         "prepend_text",                                         Py(                                             0x00007f7fead8be30,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff31c3d30,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "append_text",                         lookup_key: Simple {                             key: "append_text",                             py_key: Py(                                 0x00007f7fead8be70,                             ),                             path: LookupPath(                                 [                                     S(                                         "append_text",                                         Py(                                             0x00007f7fead8beb0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7ff31c3d70,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f7ff5220030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f7ff21764f0,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "filepath_files",                         lookup_key: Simple {                             key: "filepath_files",                             py_key: Py(                                 0x00007f7fead8bef0,                             ),                             path: LookupPath(                                 [                                     S(                                         "filepath_files",                                         Py(                                             0x00007f7fead8bf30,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7fead89070,                         ),                         validator: FunctionAfter(                             FunctionAfterValidator {                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 func: Py(                                     0x00007f7fead89b40,                                 ),                                 config: Py(                                     0x00007f7fead8bc40,                                 ),                                 name: "function-after[validate_filepath_files(), str]",                                 field_name: None,                                 info_arg: false,                             },                         ),                         frozen: false,                     },                     Field {                         name: "filepath_executable",                         lookup_key: Simple {                             key: "filepath_executable",                             py_key: Py(                                 0x00007f7fead6ba00,                             ),                             path: LookupPath(                                 [                                     S(                                         "filepath_executable",                                         Py(                                             0x00007f7fead6ba50,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f7feaccafb0,                         ),                         validator: Str(                             StrValidator {                                 strict: false,                                 coerce_numbers_to_str: false,                             },                         ),                         frozen: false,                     },                 ],                 model_name: "Model",                 extra_behavior: Ignore,                 extras_validator: None,                 strict: false,                 from_attributes: false,                 loc_by_alias: true,             },         ),         class: Py(             0x000055be86684600,         ),         post_init: None,         frozen: false,         custom_init: false,         root_model: false,         undefined: Py(             0x00007f7ff21764f0,         ),         name: "Model",     }, ), definitions=[], cache_strings=True)#
__signature__: ClassVar[Signature] = <Signature (*, label: typing.Annotated[str, {'priority': 0}, {'short_name': '-L'}], description: typing.Annotated[str, {'priority': 0}, {'short_name': '-D'}] = '', default_calc_job_plugin: Annotated[Optional[str], {'priority': 0}, {'short_name': '-P'}] = None, use_double_quotes: typing.Annotated[bool, {'priority': 0}] = False, with_mpi: Annotated[Optional[bool], {'priority': 0}] = None, prepend_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', append_text: typing.Annotated[str, {'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}] = '', filepath_files: typing.Annotated[str, {'priority': 2}, {'short_name': '-F'}], filepath_executable: typing.Annotated[str, {'priority': 1}, {'short_name': '-X'}]) -> None>#
_abc_impl = <_abc._abc_data object>#
filepath_executable: str#
filepath_files: str#
model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'append_text': FieldInfo(annotation=str, required=False, default='', title='Append script', description='Bash commands that should be appended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='APPEND_TEXT: if there is any bash commands that should be appended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'default_calc_job_plugin': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Default `CalcJob` plugin', description='Entry point name of the default plugin (as listed in `verdi plugin list aiida.calculations`).', metadata=[{'priority': 0}, {'short_name': '-P'}]), 'description': FieldInfo(annotation=str, required=False, default='', title='Description', description='Human-readable description, ideally including version and compilation environment.', metadata=[{'priority': 0}, {'short_name': '-D'}]), 'filepath_executable': FieldInfo(annotation=str, required=True, title='Filepath executable', description='Relative filepath of executable with directory of code files.', metadata=[{'priority': 1}, {'short_name': '-X'}]), 'filepath_files': FieldInfo(annotation=str, required=True, title='Code directory', description='Filepath to directory containing code files.', metadata=[{'priority': 2}, {'short_name': '-F'}]), 'label': FieldInfo(annotation=str, required=True, title='Label', description='A unique label to identify the code by.', metadata=[{'priority': 0}, {'short_name': '-L'}]), 'prepend_text': FieldInfo(annotation=str, required=False, default='', title='Prepend script', description='Bash commands that should be prepended to the run line in all submit scripts for this code.', metadata=[{'priority': 0}, {'option_cls': functools.partial(<class 'aiida.cmdline.params.options.interactive.TemplateInteractiveOption'>, extension='.bash', header='PREPEND_TEXT: if there is any bash commands that should be prepended to the executable call in all submit scripts for this code, type that between the equal signs below and save the file.', footer='All lines that start with `#=`: will be ignored.')}]), 'use_double_quotes': FieldInfo(annotation=bool, required=False, default=False, title='Escape using double quotes', description='Whether the executable and arguments of the code in the submission script should be escaped with single or double quotes.', metadata=[{'priority': 0}]), 'with_mpi': FieldInfo(annotation=Union[bool, NoneType], required=False, default=None, title='Run with MPI', description='Whether the executable should be run as an MPI program. This option can be left unspecified in which case `None` will be set and it is left up to the calculation job plugin or inputs whether to run with MPI.', metadata=[{'priority': 0}])}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

classmethod validate_filepath_files(value: str) Path[source]#

Validate that filepath_files is an existing directory.

_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE: str = 'filepath_executable'#
__abstractmethods__ = frozenset({})#
__annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_KEY_ATTRIBUTE_APPEND_TEXT': 'str', '_KEY_ATTRIBUTE_DEFAULT_CALC_JOB_PLUGIN': 'str', '_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'str', '_KEY_ATTRIBUTE_PREPEND_TEXT': 'str', '_KEY_ATTRIBUTE_USE_DOUBLE_QUOTES': 'str', '_KEY_ATTRIBUTE_WITH_MPI': 'str', '_KEY_ATTRIBUTE_WRAP_CMDLINE_PARAMS': 'str', '_KEY_EXTRA_IS_HIDDEN': 'str', '__plugin_type_string': 'ClassVar[str]', '__qb_fields__': 'Sequence[QbField]', '__query_type_string': 'ClassVar[str]', '_export_format_replacements': 'Dict[str, str]', '_hash_ignored_attributes': 'Tuple[str, ...]', '_logger': 'Optional[Logger]', '_updatable_attributes': 'Tuple[str, ...]', 'fields': 'QbFields'}#
__init__(filepath_executable: str, filepath_files: Path, **kwargs)[source]#

Construct a new instance.

Note

If the files necessary for this code are not all located in a single directory or the directory contains files that should not be uploaded, and so the filepath_files cannot be used. One can use the methods of the aiida.orm.nodes.repository.NodeRepository class. This can be accessed through the base.repository attribute of the instance after it has been constructed. For example:

code = PortableCode(filepath_executable='some_name.exe')
code.put_object_from_file()
code.put_object_from_filelike()
code.put_object_from_tree()
Parameters:
  • filepath_executable – The relative filepath of the executable within the directory of uploaded files.

  • filepath_files – The filepath to the directory containing all the files of the code.

__module__ = 'aiida.orm.nodes.data.code.portable'#
__parameters__ = ()#
_abc_impl = <_abc._abc_data object>#
_logger: Logger | None = <Logger aiida.orm.nodes.data.code.portable.PortableCode (WARNING)>#
_validate()[source]#

Validate the instance by checking that an executable is defined and it is part of the repository files.

:raises aiida.common.exceptions.ValidationError: If the state of the node is invalid.

can_run_on_computer(computer: Computer) bool[source]#

Return whether the code can run on a given computer.

A PortableCode should be able to be run on any computer in principle.

Parameters:

computer – The computer.

Returns:

True if the provided computer is the same as the one configured for this code.

fields: QbFields = {'append_text': 'QbStrField(attributes.append_text) -> Optional[str]',  'attributes': 'QbDictField(attributes.*) -> Dict[str, Any]',  'ctime': 'QbNumericField(ctime) -> datetime',  'description': 'QbStrField(description) -> str',  'extras': 'QbDictField(extras.*) -> Dict[str, Any]',  'input_plugin': 'QbStrField(attributes.input_plugin) -> Optional[str]',  'is_local': 'QbField(attributes.is_local) -> Optional[bool]',  'label': 'QbStrField(label) -> str',  'local_executable': 'QbStrField(attributes.local_executable) -> Optional[str]',  'mtime': 'QbNumericField(mtime) -> datetime',  'node_type': 'QbStrField(node_type) -> str',  'pk': 'QbNumericField(pk) -> int',  'prepend_text': 'QbStrField(attributes.prepend_text) -> Optional[str]',  'remote_exec_path': 'QbStrField(attributes.remote_exec_path) -> Optional[str]',  'repository_metadata': 'QbDictField(repository_metadata) -> Dict[str, Any]',  'source': 'QbDictField(attributes.source.*) -> Optional[dict]',  'user_pk': 'QbNumericField(user_pk) -> int',  'uuid': 'QbStrField(uuid) -> str'}#
property filepath_executable: PurePosixPath#

Return the relative filepath of the executable that this code represents.

Returns:

The relative filepath of the executable.

property full_label: str#

Return the full label of this code.

The full label can be just the label itself but it can be something else. However, it at the very least has to include the label of the code.

Returns:

The full label of the code.

get_executable() PurePosixPath[source]#

Return the executable that the submission script should execute to run the code.

Returns:

The executable to be called in the submission script.

validate_working_directory(folder: Folder)[source]#

Validate content of the working directory created by the CalcJob plugin.

This method will be called by presubmit() when a new calculation job is launched, passing the Folder that was used by the plugin used for the calculation to create the input files for the working directory. This method can be overridden by implementations of the AbstractCode class that need to validate the contents of that folder.

Parameters:

folder – A sandbox folder that the CalcJob plugin wrote input files to that will be copied to the working directory for the corresponding calculation job instance.

Raises:

PluginInternalError – The CalcJob plugin created a file that has the same relative filepath as the executable for this portable code.