Manage code objects with lazy loading of the db env
aiida.orm.utils.builders.code.
CodeBuilder
Bases: object
object
Build a code with validation of attribute combinations
CodeType
Bases: enum.Enum
enum.Enum
An enumeration.
ON_COMPUTER
STORE_AND_UPLOAD
__module__
CodeValidationError
Bases: Exception
Exception
A CodeBuilder instance may raise this
when asked to instanciate a code with missing or invalid code attributes when asked for a code attibute that has not been set yet
when asked to instanciate a code with missing or invalid code attributes
when asked for a code attibute that has not been set yet
__init__
Initialize self. See help(type(self)) for accurate signature.
__repr__
Return repr(self).
__str__
Return str(self).
__weakref__
list of weak references to the object (if defined)
__dict__
__getattr__
Access code attributes used to build the code
__setattr__
Implement setattr(self, name, value).
_get
Return a spec, or None if not defined
key – name of a code spec
_get_and_count
Return a spec, or raise if not defined. Moreover, add the key to the ‘used’ dict.
used – should be a set of keys that you want to track. key will be added to this set if the value exists in the spec and can be retrieved.
key
_set_code_attr
Set a code attribute, if it passes validation.
Checks compatibility with other code attributes.
from_code
Create CodeBuilder from existing code instance.
See also get_code_spec()
get_code_spec()
get_code_spec
Get code attributes from existing code instance.
These attributes can be used to create a new CodeBuilder:
spec = CodeBuilder.get_code_spec(old_code) builder = CodeBuilder(**spec) new_code = builder.new()
is_local
Analogous to Code.is_local()
new
Build and return a new code instance (not stored)
validate
validate_code_type
Make sure the code type is set correctly
validate_installed
If the code is on-computer, catch invalid store-and-upload attributes
validate_upload
If the code is stored and uploaded, catch invalid on-computer attributes
Manage computer objects with lazy loading of the db env
aiida.orm.utils.builders.computer.
ComputerBuilder
Build a computer with validation of attribute combinations
ComputerValidationError
A ComputerBuilder instance may raise this
when asked to instanciate a code with missing or invalid computer attributes when asked for a computer attibute that has not been set yet.
when asked to instanciate a code with missing or invalid computer attributes
when asked for a computer attibute that has not been set yet.
Access computer attributes used to build the computer
key – name of a computer spec
_set_computer_attr
Set a computer attribute if it passes validation.
from_computer
Create ComputerBuilder from existing computer instance.
See also get_computer_spec()
get_computer_spec()
get_computer_spec
Get computer attributes from existing computer instance.
These attributes can be used to create a new ComputerBuilder:
spec = ComputerBuilder.get_computer_spec(old_computer) builder = ComputerBuilder(**spec) new_computer = builder.new()
Build and return a new computer instance (not stored)
Validate the computer options.