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(**data: Any)[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 | PluggableSchemaValidator]', '__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]'}#
- __dict__#
- __module__ = 'aiida.orm.nodes.data.code.abstract'#
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True#
Whether model building is completed, or if there are still undefined fields.
- __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'>, title=None), <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:94480875200608', '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'}#
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.abstract.AbstractCode.Model:94480875200608', 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, json_schema_input_type=PydanticUndefined))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})#
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __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', 'subject': <pydantic._internal._mock_val_ser.MockValSer object>}#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__: dict[str, Any] | None#
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x000055ee0b012060, ), serializer: Fields( GeneralFieldsSerializer { fields: { "append_text": SerField { key_py: Py( 0x00007fc245370a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "description": SerField { key_py: Py( 0x00007fc247217e30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "default_calc_job_plugin": SerField { key_py: Py( 0x00007fc2453085d0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "with_mpi": SerField { key_py: Py( 0x00007fc23ec606b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Bool( BoolSerializer, ), }, ), }, ), ), required: true, }, "label": SerField { key_py: Py( 0x00007fc2472ea430, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "prepend_text": SerField { key_py: Py( 0x00007fc245370a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "use_double_quotes": SerField { key_py: Py( 0x00007fc244b661f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d2ef60, ), ), serializer: Bool( BoolSerializer, ), }, ), ), 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=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="Model", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "label", lookup_key: Simple { key: "label", py_key: Py( 0x00007fc213e21f70, ), path: LookupPath( [ S( "label", Py( 0x00007fc213e21d70, ), ), ], ), }, name_py: Py( 0x00007fc2472ea430, ), validator: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc23e462500, ), config: Py( 0x00007fc213e22000, ), 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( 0x00007fc213e21ef0, ), path: LookupPath( [ S( "description", Py( 0x00007fc213e21f30, ), ), ], ), }, name_py: Py( 0x00007fc247217e30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "default_calc_job_plugin", lookup_key: Simple { key: "default_calc_job_plugin", py_key: Py( 0x00007fc21320b960, ), path: LookupPath( [ S( "default_calc_job_plugin", Py( 0x00007fc212ddfc30, ), ), ], ), }, name_py: Py( 0x00007fc2453085d0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "use_double_quotes", lookup_key: Simple { key: "use_double_quotes", py_key: Py( 0x00007fc212dde600, ), path: LookupPath( [ S( "use_double_quotes", Py( 0x00007fc212ddd9d0, ), ), ], ), }, name_py: Py( 0x00007fc244b661f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d2ef60, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "with_mpi", lookup_key: Simple { key: "with_mpi", py_key: Py( 0x00007fc213e21eb0, ), path: LookupPath( [ S( "with_mpi", Py( 0x00007fc213e21e70, ), ), ], ), }, name_py: Py( 0x00007fc23ec606b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "prepend_text", lookup_key: Simple { key: "prepend_text", py_key: Py( 0x00007fc213e21e30, ), path: LookupPath( [ S( "prepend_text", Py( 0x00007fc213e21df0, ), ), ], ), }, name_py: Py( 0x00007fc245370a30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "append_text", lookup_key: Simple { key: "append_text", py_key: Py( 0x00007fc213e21db0, ), path: LookupPath( [ S( "append_text", Py( 0x00007fc213e21d30, ), ), ], ), }, name_py: Py( 0x00007fc245370a70, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, ], model_name: "Model", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x000055ee0b012060, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007fc24570ee20, ), name: "Model", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __weakref__#
list of weak references to the object
- _abc_impl = <_abc._abc_data object>#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'defer_build': True}#
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] objects.
This replaces Model.__fields__ from Pydantic V1.
- __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>#
- 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 oncomputer
,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 theCalcJob
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 thecode
input already populated with ourselves- Raises:
aiida.common.EntryPointError – if the specified plugin does not exist.
ValueError – if no default plugin was specified.
- 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 theCalcJob
.
- Returns:
List of command line parameters to be prepended to the executable in submission line.
Return whether the code is hidden.
- Returns:
True
if the code is hidden,False
otherwise, which is also the default.
- 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 theFolder
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 theAbstractCode
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 = '')[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 | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'computer': 't.Union[str, Computer]', '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'}#
- __dict__#
- __module__ = 'aiida.orm.nodes.data.code.containerized'#
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True#
Whether model building is completed, or if there are still undefined fields.
- __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:94480876930432', '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'>, title=None)]}, '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': {'choices': [{'type': 'str'}, {'cls': <class 'aiida.orm.computers.Computer'>, 'type': 'is-instance'}], 'type': 'union'}, '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'}#
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94480876930432', 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, json_schema_input_type=PydanticUndefined)), 'validate_computer': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94480876930432', 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, json_schema_input_type=PydanticUndefined))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={'validate_full_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.containerized.ContainerizedCode.Model:94480876930432', cls_var_name='validate_full_label_uniqueness', func=<function InstalledCode.Model.validate_full_label_uniqueness>, shim=None, info=ModelValidatorDecoratorInfo(mode='after'))}, computed_fields={})#
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __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', 'subject': <pydantic._internal._mock_val_ser.MockValSer object>}#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__: dict[str, Any] | None#
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x000055ee0b1b8580, ), serializer: Fields( GeneralFieldsSerializer { fields: { "computer": SerField { key_py: Py( 0x00007fc2452e23b0, ), alias: None, alias_py: None, serializer: Some( Union( UnionSerializer { choices: [ Str( StrSerializer, ), Any( AnySerializer, ), ], name: "Union[str, any]", }, ), ), required: true, }, "label": SerField { key_py: Py( 0x00007fc2472ea430, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "with_mpi": SerField { key_py: Py( 0x00007fc23ec606b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Bool( BoolSerializer, ), }, ), }, ), ), required: true, }, "prepend_text": SerField { key_py: Py( 0x00007fc245370a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "default_calc_job_plugin": SerField { key_py: Py( 0x00007fc2453085d0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "use_double_quotes": SerField { key_py: Py( 0x00007fc244b661f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d2ef60, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "wrap_cmdline_params": SerField { key_py: Py( 0x00007fc23ec1e5b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d2ef60, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "image_name": SerField { key_py: Py( 0x00007fc23e462070, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "append_text": SerField { key_py: Py( 0x00007fc245370a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "description": SerField { key_py: Py( 0x00007fc247217e30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "filepath_executable": SerField { key_py: Py( 0x00007fc23e4df690, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "engine_command": SerField { key_py: Py( 0x00007fc23e461ff0, ), 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: 12, }, ), has_extra: false, root_model: false, name: "Model", }, ), definitions=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = 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( 0x00007fc214c7b770, ), path: LookupPath( [ S( "label", Py( 0x00007fc214c7bd30, ), ), ], ), }, name_py: Py( 0x00007fc2472ea430, ), validator: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc23e499e40, ), config: Py( 0x00007fc214c7ba00, ), 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( 0x00007fc214c7beb0, ), path: LookupPath( [ S( "description", Py( 0x00007fc214c7b870, ), ), ], ), }, name_py: Py( 0x00007fc247217e30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "default_calc_job_plugin", lookup_key: Simple { key: "default_calc_job_plugin", py_key: Py( 0x00007fc212b1d9d0, ), path: LookupPath( [ S( "default_calc_job_plugin", Py( 0x00007fc212b1d890, ), ), ], ), }, name_py: Py( 0x00007fc2453085d0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "use_double_quotes", lookup_key: Simple { key: "use_double_quotes", py_key: Py( 0x00007fc212b1d8e0, ), path: LookupPath( [ S( "use_double_quotes", Py( 0x00007fc212b1d7a0, ), ), ], ), }, name_py: Py( 0x00007fc244b661f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d2ef60, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "with_mpi", lookup_key: Simple { key: "with_mpi", py_key: Py( 0x00007fc214c7bfb0, ), path: LookupPath( [ S( "with_mpi", Py( 0x00007fc214c7bf70, ), ), ], ), }, name_py: Py( 0x00007fc23ec606b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "prepend_text", lookup_key: Simple { key: "prepend_text", py_key: Py( 0x00007fc214c7bf30, ), path: LookupPath( [ S( "prepend_text", Py( 0x00007fc214c7bef0, ), ), ], ), }, name_py: Py( 0x00007fc245370a30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "append_text", lookup_key: Simple { key: "append_text", py_key: Py( 0x00007fc214c7be70, ), path: LookupPath( [ S( "append_text", Py( 0x00007fc214c7be30, ), ), ], ), }, name_py: Py( 0x00007fc245370a70, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "computer", lookup_key: Simple { key: "computer", py_key: Py( 0x00007fc214c7bdf0, ), path: LookupPath( [ S( "computer", Py( 0x00007fc214c7bdb0, ), ), ], ), }, name_py: Py( 0x00007fc2452e23b0, ), validator: FunctionAfter( FunctionAfterValidator { validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( IsInstance( IsInstanceValidator { class: Py( 0x000055ee0ab4a5b0, ), class_repr: "Computer", name: "is-instance[Computer]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,is-instance[Computer]]", }, ), func: Py( 0x00007fc23e499e80, ), config: Py( 0x00007fc214c7ba00, ), name: "function-after[validate_computer(), union[str,is-instance[Computer]]]", field_name: None, info_arg: false, }, ), frozen: false, }, Field { name: "filepath_executable", lookup_key: Simple { key: "filepath_executable", py_key: Py( 0x00007fc212b1d5c0, ), path: LookupPath( [ S( "filepath_executable", Py( 0x00007fc212b1d520, ), ), ], ), }, name_py: Py( 0x00007fc23e4df690, ), 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( 0x00007fc214c792b0, ), path: LookupPath( [ S( "engine_command", Py( 0x00007fc2151989f0, ), ), ], ), }, name_py: Py( 0x00007fc23e461ff0, ), 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( 0x00007fc2150ae270, ), path: LookupPath( [ S( "image_name", Py( 0x00007fc2169d45f0, ), ), ], ), }, name_py: Py( 0x00007fc23e462070, ), 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( 0x00007fc212b1d4d0, ), path: LookupPath( [ S( "wrap_cmdline_params", Py( 0x00007fc212b1dac0, ), ), ], ), }, name_py: Py( 0x00007fc23ec1e5b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d2ef60, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, ], model_name: "Model", extra_behavior: Ignore, extras_validator: None, strict: false, from_attributes: false, loc_by_alias: true, }, ), class: Py( 0x000055ee0b1b8580, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007fc24570ee20, ), name: "Model", }, ), func: Py( 0x00007fc23e40ab60, ), config: Py( 0x00007fc214cd0f40, ), name: "function-after[validate_full_label_uniqueness(), Model]", field_name: None, info_arg: false, }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __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: Annotated[Union[str, aiida.orm.computers.Computer], {'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>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'defer_build': True}#
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=Union[str, Computer], 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] objects.
This replaces Model.__fields__ from Pydantic V1.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_EMIT_CODE_DEPRECATION_WARNING': 'bool', '_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.
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 = '')[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 | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'computer': 't.Union[str, Computer]', '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]'}#
- __dict__#
- __module__ = 'aiida.orm.nodes.data.code.installed'#
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True#
Whether model building is completed, or if there are still undefined fields.
- __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:94480872530848', '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'>, title=None)]}, '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': {'choices': [{'type': 'str'}, {'cls': <class 'aiida.orm.computers.Computer'>, 'type': 'is-instance'}], 'type': 'union'}, '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'}#
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94480872530848', 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, json_schema_input_type=PydanticUndefined)), 'validate_computer': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94480872530848', 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, json_schema_input_type=PydanticUndefined))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={'validate_full_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.installed.InstalledCode.Model:94480872530848', cls_var_name='validate_full_label_uniqueness', func=<function InstalledCode.Model.validate_full_label_uniqueness>, shim=None, info=ModelValidatorDecoratorInfo(mode='after'))}, computed_fields={})#
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = {'_EMIT_CODE_DEPRECATION_WARNING': False, '_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'filepath_executable', '__annotations__': {'_EMIT_CODE_DEPRECATION_WARNING': 'bool', '_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', 'subject': <pydantic._internal._mock_val_ser.MockValSer object>}#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__: dict[str, Any] | None#
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x000055ee0ad863a0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "use_double_quotes": SerField { key_py: Py( 0x00007fc244b661f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d2ef60, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "filepath_executable": SerField { key_py: Py( 0x00007fc23e4df690, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "description": SerField { key_py: Py( 0x00007fc247217e30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "default_calc_job_plugin": SerField { key_py: Py( 0x00007fc2453085d0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), required: true, }, "with_mpi": SerField { key_py: Py( 0x00007fc23ec606b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Bool( BoolSerializer, ), }, ), }, ), ), required: true, }, "prepend_text": SerField { key_py: Py( 0x00007fc245370a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "label": SerField { key_py: Py( 0x00007fc2472ea430, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "append_text": SerField { key_py: Py( 0x00007fc245370a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "computer": SerField { key_py: Py( 0x00007fc2452e23b0, ), alias: None, alias_py: None, serializer: Some( Union( UnionSerializer { choices: [ Str( StrSerializer, ), Any( AnySerializer, ), ], name: "Union[str, any]", }, ), ), 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=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = 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( 0x00007fc212bfd0b0, ), path: LookupPath( [ S( "label", Py( 0x00007fc212be7370, ), ), ], ), }, name_py: Py( 0x00007fc2472ea430, ), validator: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc23e460d80, ), config: Py( 0x00007fc215ab8040, ), 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( 0x00007fc212be6130, ), path: LookupPath( [ S( "description", Py( 0x00007fc212be71b0, ), ), ], ), }, name_py: Py( 0x00007fc247217e30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "default_calc_job_plugin", lookup_key: Simple { key: "default_calc_job_plugin", py_key: Py( 0x00007fc212b55d90, ), path: LookupPath( [ S( "default_calc_job_plugin", Py( 0x00007fc212b56830, ), ), ], ), }, name_py: Py( 0x00007fc2453085d0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "use_double_quotes", lookup_key: Simple { key: "use_double_quotes", py_key: Py( 0x00007fc212b575f0, ), path: LookupPath( [ S( "use_double_quotes", Py( 0x00007fc212a053e0, ), ), ], ), }, name_py: Py( 0x00007fc244b661f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d2ef60, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "with_mpi", lookup_key: Simple { key: "with_mpi", py_key: Py( 0x00007fc212be7470, ), path: LookupPath( [ S( "with_mpi", Py( 0x00007fc212be71f0, ), ), ], ), }, name_py: Py( 0x00007fc23ec606b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "prepend_text", lookup_key: Simple { key: "prepend_text", py_key: Py( 0x00007fc212be7530, ), path: LookupPath( [ S( "prepend_text", Py( 0x00007fc212be7630, ), ), ], ), }, name_py: Py( 0x00007fc245370a30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "append_text", lookup_key: Simple { key: "append_text", py_key: Py( 0x00007fc212be75f0, ), path: LookupPath( [ S( "append_text", Py( 0x00007fc212be75b0, ), ), ], ), }, name_py: Py( 0x00007fc245370a70, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "computer", lookup_key: Simple { key: "computer", py_key: Py( 0x00007fc212be7570, ), path: LookupPath( [ S( "computer", Py( 0x00007fc212be73b0, ), ), ], ), }, name_py: Py( 0x00007fc2452e23b0, ), validator: FunctionAfter( FunctionAfterValidator { validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( IsInstance( IsInstanceValidator { class: Py( 0x000055ee0ab4a5b0, ), class_repr: "Computer", name: "is-instance[Computer]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,is-instance[Computer]]", }, ), func: Py( 0x00007fc23e460c40, ), config: Py( 0x00007fc215ab8040, ), name: "function-after[validate_computer(), union[str,is-instance[Computer]]]", field_name: None, info_arg: false, }, ), frozen: false, }, Field { name: "filepath_executable", lookup_key: Simple { key: "filepath_executable", py_key: Py( 0x00007fc212a05110, ), path: LookupPath( [ S( "filepath_executable", Py( 0x00007fc212a07000, ), ), ], ), }, name_py: Py( 0x00007fc23e4df690, ), 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( 0x000055ee0ad863a0, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007fc24570ee20, ), name: "Model", }, ), func: Py( 0x00007fc23e40ab60, ), config: Py( 0x00007fc212bfb980, ), name: "function-after[validate_full_label_uniqueness(), Model]", field_name: None, info_arg: false, }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __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: Annotated[Union[str, aiida.orm.computers.Computer], {'priority': 2}, {'short_name': '-Y'}], filepath_executable: typing.Annotated[str, {'priority': 1}, {'short_name': '-X'}]) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'defer_build': True}#
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=Union[str, Computer], 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] objects.
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.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_EMIT_CODE_DEPRECATION_WARNING': 'bool', '_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>#
- _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.
- 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 ofCode
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__ = ()#
- __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)]#
- _abc_impl = <_abc._abc_data object>#
- _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 callsuper()._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 oncomputer
,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:
aiida.common.NotExistent – if no code identified by the given string is found
aiida.common.MultipleObjectsError – if the string cannot identify uniquely a code
ValueError – if neither a pk nor a label was passed in
- 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:
aiida.common.NotExistent – if no code identified by the given string is found
aiida.common.MultipleObjectsError – if the string cannot identify uniquely a code
- 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:
aiida.common.NotExistent – if no code identified by the given string is found
aiida.common.MultipleObjectsError – if the string cannot identify uniquely a code
TypeError – if code_string is not of string type
- get_input_plugin_name()[source]#
Return the name of the default input plugin (or None if no input plugin was set.
- 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_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.
Determines whether the Code is hidden or not
- 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.
- 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 ofCode
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 = '')[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 | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'append_text': 'str', 'default_calc_job_plugin': 't.Optional[str]', 'description': 'str', 'filepath_executable': 'str', 'filepath_files': 't.Union[str, pathlib.Path]', '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]'}#
- __dict__#
- __module__ = 'aiida.orm.nodes.data.code.portable'#
- __private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}#
Metadata about the private attributes of the model.
- __pydantic_complete__: ClassVar[bool] = True#
Whether model building is completed, or if there are still undefined fields.
- __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'>, title=None), <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:94480876134352', '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': {'choices': [{'type': 'str'}, {'lax_schema': {'choices': [{'json_schema': {'function': {'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'cls': <class 'pathlib.Path'>, 'type': 'is-instance'}, 'type': 'json-or-python'}, {'function': {'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}], 'custom_error_message': "Input is not a valid path for <class 'pathlib.Path'>", 'custom_error_type': 'path_type', 'strict': True, 'type': 'union'}, 'metadata': {'pydantic_js_annotation_functions': [<bound method InnerSchemaValidator.__get_pydantic_json_schema__ of InnerSchemaValidator(core_schema={'type': 'lax-or-strict', 'lax_schema': {'type': 'union', 'choices': [{'type': 'json-or-python', 'json_schema': {'type': 'function-after', 'function': {'type': 'no-info', 'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>}, 'schema': {'type': 'str'}}, 'python_schema': {'type': 'is-instance', 'cls': <class 'pathlib.Path'>}}, {'type': 'function-after', 'function': {'type': 'no-info', 'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>}, 'schema': {'type': 'str'}}], 'custom_error_type': 'path_type', 'custom_error_message': "Input is not a valid path for <class 'pathlib.Path'>", 'strict': True}, 'strict_schema': {'type': 'json-or-python', 'json_schema': {'type': 'function-after', 'function': {'type': 'no-info', 'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>}, 'schema': {'type': 'str'}}, 'python_schema': {'type': 'is-instance', 'cls': <class 'pathlib.Path'>}}, 'serialization': {'type': 'to-string'}, 'metadata': {'pydantic_js_annotation_functions': [<bound method InnerSchemaValidator.__get_pydantic_json_schema__ of ...>]}}, js_schema=None, js_core_schema={'type': 'str'}, js_schema_update={'format': 'path'})>]}, 'serialization': {'type': 'to-string'}, 'strict_schema': {'json_schema': {'function': {'function': <function path_schema_prepare_pydantic_annotations.<locals>.path_validator>, 'type': 'no-info'}, 'schema': {'type': 'str'}, 'type': 'function-after'}, 'python_schema': {'cls': <class 'pathlib.Path'>, 'type': 'is-instance'}, 'type': 'json-or-python'}, 'type': 'lax-or-strict'}], 'type': 'union'}, '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'}#
The core schema of the model.
- __pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={'validate_label_uniqueness': Decorator(cls_ref='aiida.orm.nodes.data.code.portable.PortableCode.Model:94480876134352', 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, json_schema_input_type=PydanticUndefined)), 'validate_filepath_files': Decorator(cls_ref='aiida.orm.nodes.data.code.portable.PortableCode.Model:94480876134352', 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, json_schema_input_type=PydanticUndefined))}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})#
Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.
- __pydantic_extra__: dict[str, Any] | None#
A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.
- __pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}#
Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.
- __pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = {'_EMIT_CODE_DEPRECATION_WARNING': False, '_KEY_ATTRIBUTE_FILEPATH_EXECUTABLE': 'filepath_executable', '__annotations__': {'_EMIT_CODE_DEPRECATION_WARNING': 'bool', '_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', 'subject': <pydantic._internal._mock_val_ser.MockValSer object>}#
Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None#
The name of the post-init method for the model, if defined.
- __pydantic_private__: dict[str, Any] | None#
Values of private attributes set on the model instance.
- __pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model( ModelSerializer { class: Py( 0x000055ee0b0f5fd0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "prepend_text": SerField { key_py: Py( 0x00007fc245370a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "append_text": SerField { key_py: Py( 0x00007fc245370a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "use_double_quotes": SerField { key_py: Py( 0x00007fc244b661f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d2ef60, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "label": SerField { key_py: Py( 0x00007fc2472ea430, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "description": SerField { key_py: Py( 0x00007fc247217e30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247e3c420, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "filepath_files": SerField { key_py: Py( 0x00007fc23e49a0f0, ), alias: None, alias_py: None, serializer: Some( Union( UnionSerializer { choices: [ Str( StrSerializer, ), ToString( ToStringSerializer { when_used: JsonUnlessNone, }, ), ], name: "Union[str, to-string]", }, ), ), required: true, }, "filepath_executable": SerField { key_py: Py( 0x00007fc23e4df690, ), alias: None, alias_py: None, serializer: Some( Str( StrSerializer, ), ), required: true, }, "with_mpi": SerField { key_py: Py( 0x00007fc23ec606b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Bool( BoolSerializer, ), }, ), }, ), ), required: true, }, "default_calc_job_plugin": SerField { key_py: Py( 0x00007fc2453085d0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007fc247d43c20, ), ), serializer: Nullable( NullableSerializer { serializer: Str( StrSerializer, ), }, ), }, ), ), 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=[])#
The pydantic-core SchemaSerializer used to dump instances of the model.
- __pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="Model", validator=Model( ModelValidator { revalidate: Never, validator: ModelFields( ModelFieldsValidator { fields: [ Field { name: "label", lookup_key: Simple { key: "label", py_key: Py( 0x00007fc2128da9f0, ), path: LookupPath( [ S( "label", Py( 0x00007fc2128da9b0, ), ), ], ), }, name_py: Py( 0x00007fc2472ea430, ), validator: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc23e49a940, ), config: Py( 0x00007fc2128da940, ), 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( 0x00007fc2128daa70, ), path: LookupPath( [ S( "description", Py( 0x00007fc2128daa30, ), ), ], ), }, name_py: Py( 0x00007fc247217e30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "default_calc_job_plugin", lookup_key: Simple { key: "default_calc_job_plugin", py_key: Py( 0x00007fc21287f5f0, ), path: LookupPath( [ S( "default_calc_job_plugin", Py( 0x00007fc21287f550, ), ), ], ), }, name_py: Py( 0x00007fc2453085d0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "use_double_quotes", lookup_key: Simple { key: "use_double_quotes", py_key: Py( 0x00007fc21287f230, ), path: LookupPath( [ S( "use_double_quotes", Py( 0x00007fc21287f280, ), ), ], ), }, name_py: Py( 0x00007fc244b661f0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d2ef60, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "with_mpi", lookup_key: Simple { key: "with_mpi", py_key: Py( 0x00007fc2128daab0, ), path: LookupPath( [ S( "with_mpi", Py( 0x00007fc2128daaf0, ), ), ], ), }, name_py: Py( 0x00007fc23ec606b0, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247d43c20, ), ), 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( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "prepend_text", lookup_key: Simple { key: "prepend_text", py_key: Py( 0x00007fc2128dab30, ), path: LookupPath( [ S( "prepend_text", Py( 0x00007fc2128dab70, ), ), ], ), }, name_py: Py( 0x00007fc245370a30, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "append_text", lookup_key: Simple { key: "append_text", py_key: Py( 0x00007fc2128dabb0, ), path: LookupPath( [ S( "append_text", Py( 0x00007fc2128dabf0, ), ), ], ), }, name_py: Py( 0x00007fc245370a70, ), validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007fc247e3c420, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007fc24570ee20, ), }, ), frozen: false, }, Field { name: "filepath_files", lookup_key: Simple { key: "filepath_files", py_key: Py( 0x00007fc2128dac30, ), path: LookupPath( [ S( "filepath_files", Py( 0x00007fc2128dac70, ), ), ], ), }, name_py: Py( 0x00007fc23e49a0f0, ), validator: FunctionAfter( FunctionAfterValidator { validator: Union( UnionValidator { mode: Smart, choices: [ ( Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), None, ), ( LaxOrStrict( LaxOrStrictValidator { strict: false, lax_validator: Union( UnionValidator { mode: Smart, choices: [ ( JsonOrPython( JsonOrPython { json: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc21418ad40, ), config: Py( 0x00007fc2128da940, ), name: "function-after[path_validator(), str]", field_name: None, info_arg: false, }, ), python: IsInstance( IsInstanceValidator { class: Py( 0x000055ee0a071e10, ), class_repr: "Path", name: "is-instance[Path]", }, ), name: "json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]]", }, ), None, ), ( FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc21418ad40, ), config: Py( 0x00007fc2128da940, ), name: "function-after[path_validator(), str]", field_name: None, info_arg: false, }, ), None, ), ], custom_error: Some( Custom( PydanticCustomError { error_type: "path_type", message_template: "Input is not a valid path for <class 'pathlib.Path'>", context: None, }, ), ), strict: true, name: "union[json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]],function-after[path_validator(), str]]", }, ), strict_validator: JsonOrPython( JsonOrPython { json: FunctionAfter( FunctionAfterValidator { validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), func: Py( 0x00007fc21418ad40, ), config: Py( 0x00007fc2128da940, ), name: "function-after[path_validator(), str]", field_name: None, info_arg: false, }, ), python: IsInstance( IsInstanceValidator { class: Py( 0x000055ee0a071e10, ), class_repr: "Path", name: "is-instance[Path]", }, ), name: "json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]]", }, ), name: "lax-or-strict[lax=union[json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]],function-after[path_validator(), str]],strict=json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]]]", }, ), None, ), ], custom_error: None, strict: false, name: "union[str,lax-or-strict[lax=union[json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]],function-after[path_validator(), str]],strict=json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]]]]", }, ), func: Py( 0x00007fc23e49ad40, ), config: Py( 0x00007fc2128da940, ), name: "function-after[validate_filepath_files(), union[str,lax-or-strict[lax=union[json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]],function-after[path_validator(), str]],strict=json-or-python[json=function-after[path_validator(), str],python=is-instance[Path]]]]]", field_name: None, info_arg: false, }, ), frozen: false, }, Field { name: "filepath_executable", lookup_key: Simple { key: "filepath_executable", py_key: Py( 0x00007fc2128c82b0, ), path: LookupPath( [ S( "filepath_executable", Py( 0x00007fc2128c8300, ), ), ], ), }, name_py: Py( 0x00007fc23e4df690, ), 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( 0x000055ee0b0f5fd0, ), post_init: None, frozen: false, custom_init: false, root_model: false, undefined: Py( 0x00007fc24570ee20, ), name: "Model", }, ), definitions=[], cache_strings=True)#
The pydantic-core SchemaValidator used to validate instances of the model.
- __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: Annotated[Union[str, pathlib.Path], {'priority': 2}, {'short_name': '-F'}], filepath_executable: typing.Annotated[str, {'priority': 1}, {'short_name': '-X'}]) -> None>#
The synthesized __init__ [Signature][inspect.Signature] of the model.
- _abc_impl = <_abc._abc_data object>#
- filepath_files: t.Union[str, pathlib.Path]#
- model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'defer_build': True}#
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=Union[str, Path], 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] objects.
This replaces Model.__fields__ from Pydantic V1.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'_CLS_COLLECTION': 'Type[CollectionType]', '_EMIT_CODE_DEPRECATION_WARNING': 'bool', '_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 theaiida.orm.nodes.repository.NodeRepository
class. This can be accessed through thebase.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>#
- _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 theFolder
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 theAbstractCode
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.