aiida.orm.implementation.django package¶
Subpackages¶
Submodules¶
-
class
aiida.orm.implementation.django.backend.
DjangoBackend
[source]¶ Bases:
aiida.orm.backend.Backend
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.backend'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 119¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
log
¶
-
-
class
aiida.orm.implementation.django.code.
Code
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.code.AbstractCode
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.code'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_logger
= <logging.Logger object>¶
-
_plugin_type_string
= 'code.Code.'¶
-
_query_type_string
= 'code.'¶
-
_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)
-
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.
-
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: - NotExistent – if no code identified by the given string is found
- MultipleObjectsError – if the string cannot identify uniquely a code
- InputValidationError – if neither a pk nor a label was passed in
-
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: - NotExistent – if no code identified by the given string is found
- MultipleObjectsError – if the string cannot identify uniquely a code
- InputValidationError – if code_string is not of string type
-
classmethod
list_for_plugin
(plugin, labels=True)[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.
-
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.
- Args:
- remote_computer_exec: a tuple (computer, remote_exec_path), where
- computer is a aiida.orm.Computer or an aiida.backends.djsite.db.models.DbComputer object, and remote_exec_path is the absolute path of the main executable on remote computer.
-
-
aiida.orm.implementation.django.code.
delete_code
(code)[source]¶ Delete a code from the DB. Check before that there are no output nodes.
NOTE! Not thread safe… Do not use with many users accessing the DB at the same time.
Implemented as a function on purpose, otherwise complicated logic would be needed to set the internal state of the object after calling computer.delete().
-
class
aiida.orm.implementation.django.comment.
Comment
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.comment.AbstractComment
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.comment'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
id
¶
-
pk
¶
-
to_be_stored
¶
-
uuid
¶
-
-
class
aiida.orm.implementation.django.computer.
Computer
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.computer.AbstractComputer
-
__module__
= 'aiida.orm.implementation.django.computer'¶
-
dbcomputer
¶
-
description
¶
-
full_text_info
¶
-
classmethod
get
(computer)[source]¶ Return a computer from its name (or from another Computer or DbComputer instance)
-
get_dbauthinfo
(user)[source]¶ Return the aiida.backends.djsite.db.models.DbAuthInfo instance for the given user on this computer, if the computer is not configured for the given user.
Parameters: user – a DbUser instance. Returns: a aiida.backends.djsite.db.models.DbAuthInfo instance Raises: NotExistent – if the computer is not configured for the given user.
-
hostname
¶
-
id
¶
-
is_user_configured
(user)[source]¶ Return True if the computer is configured for the given user, False otherwise.
Parameters: user – a DbUser instance. Returns: a boolean.
-
is_user_enabled
(user)[source]¶ Return True if the computer is enabled for the given user (looking only at the per-user setting: the computer could still be globally disabled).
Note: Return False also if the user is not configured for the computer. Parameters: user – a DbUser instance. Returns: a boolean.
-
name
¶
-
pk
¶
-
store
()[source]¶ Store the computer in the DB.
Differently from Nodes, a computer can be re-stored if its properties are to be changed (e.g. a new mpirun command, etc.)
-
to_be_stored
¶
-
uuid
¶
-
-
class
aiida.orm.implementation.django.computer.
Util
[source]¶ Bases:
aiida.orm.implementation.general.computer.Util
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.computer'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
aiida.orm.implementation.django.group.
Group
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.group.AbstractGroup
-
__abstractmethods__
= frozenset([])¶
-
__init__
(**kwargs)[source]¶ Create a new group. Either pass a dbgroup parameter, to reload ad group from the DB (and then, no further parameters are allowed), or pass the parameters for the Group creation.
Parameters: - dbgroup – the dbgroup object, if you want to reload the group from the DB rather than creating a new one.
- name – The group name, required on creation
- description – The group description (by default, an empty string)
- user – The owner of the group (by default, the automatic user)
- type_string – a string identifying the type of group (by default, an empty string, indicating an user-defined group.
-
__int__
()[source]¶ Convert the class to an integer. This is needed to allow querying with Django. Be careful, though, not to pass it to a wrong field! This only returns the local DB principal key (pk) value.
Returns: the integer pk of the node or None if not stored.
-
__module__
= 'aiida.orm.implementation.django.group'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
add_nodes
(nodes)[source]¶ Add a node or a set of nodes to the group.
Note: The group must be already stored. Note: each of the nodes passed to add_nodes must be already stored. Parameters: nodes – a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add.
-
dbgroup
¶
-
description
¶
-
id
¶
-
is_stored
¶
-
name
¶
-
nodes
¶
-
pk
¶
-
classmethod
query
(name=None, type_string='', pk=None, uuid=None, nodes=None, user=None, node_attributes=None, past_days=None, name_filters=None, **kwargs)[source]¶ Query for groups.
Note: By default, query for user-defined groups only (type_string==”“). If you want to query for all type of groups, pass type_string=None. If you want to query for a specific type of groups, pass a specific string as the type_string argument.
Parameters: - name – the name of the group
- nodes – a node or list of nodes that belongs to the group (alternatively, you can also pass a DbNode or list of DbNodes)
- pk – the pk of the group
- uuid – the uuid of the group
- type_string – the string for the type of node; by default, look only for user-defined groups (see note above).
- user – by default, query for groups of all users; if specified, must be a DbUser object, or a string for the user email.
- past_days – by default, query for all groups; if specified, query the groups created in the last past_days. Must be a datetime object.
- node_attributes – if not None, must be a dictionary with format {k: v}. It will filter and return only groups where there is at least a node with an attribute with key=k and value=v. Different keys of the dictionary are joined with AND (that is, the group should satisfy all requirements. v can be a base data type (str, bool, int, float, …) If it is a list or iterable, that the condition is checked so that there should be at least a node in the group with key=k and value=each of the values of the iterable.
- kwargs –
any other filter to be passed to DbGroup.objects.filter
- Example: if
node_attributes = {'elements': ['Ba', 'Ti'], 'md5sum': 'xxx'}
, - it will find groups that contain the node with md5sum = ‘xxx’, and moreover contain at least one node for element ‘Ba’ and one node for element ‘Ti’.
- Example: if
-
remove_nodes
(nodes)[source]¶ Remove a node or a set of nodes to the group.
Note: The group must be already stored. Note: each of the nodes passed to add_nodes must be already stored. Parameters: nodes – a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add.
-
type_string
¶
-
user
¶
-
uuid
¶
-
-
class
aiida.orm.implementation.django.lock.
Lock
(dblock)[source]¶ Bases:
aiida.orm.implementation.general.lock.AbstractLock
-
__module__
= 'aiida.orm.implementation.django.lock'¶
-
isexpired
¶
-
key
¶
-
-
class
aiida.orm.implementation.django.lock.
LockManager
[source]¶ Bases:
aiida.orm.implementation.general.lock.AbstractLockManager
-
__module__
= 'aiida.orm.implementation.django.lock'¶
-
aquire
(key, timeout=3600, owner='None')[source]¶ The class tries to generate a new DbLock object with a key, unique in the model. If the creation goes good the Lock is generated and returned, if not an error is raised. :param key: the unique lock key, a string :param timeout: how long the :return: a Lock object :raise: InternalError: if there is an expired lock with the same input key :raise: LockPresent: if there is a Lock already present with the same key
-
-
class
aiida.orm.implementation.django.log.
DjangoLog
[source]¶ Bases:
aiida.orm.log.Log
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.log'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 119¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
class
aiida.orm.implementation.django.log.
DjangoLogEntry
(model)[source]¶ Bases:
aiida.orm.log.LogEntry
-
__abstractmethods__
= frozenset([])¶
-
__init__
(model)[source]¶ Parameters: model – aiida.backends.djsite.db.models.DbLog
-
__module__
= 'aiida.orm.implementation.django.log'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 119¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
id
¶ Get the primary key of the entry
-
levelname
¶ The name of the log level
-
loggername
¶ The name of the logger that created this entry
-
message
¶ Get the message corresponding to the entry
-
metadata
¶ Get the metadata corresponding to the entry
-
objname
¶ Get the name of the object that created the log entry
-
objpk
¶ Get the id of the object that created the log entry
-
time
¶ Get the time corresponding to the entry
-
-
class
aiida.orm.implementation.django.node.
Node
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.node.AbstractNode
-
__abstractmethods__
= frozenset([])¶
-
__init__
(**kwargs)[source]¶ Initialize the object Node.
Parameters: uuid – if present, the Node with given uuid is loaded from the database. (It is not possible to assign a uuid to a new Node.)
-
__module__
= 'aiida.orm.implementation.django.node'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_add_dblink_from
(src, label=None, link_type=<LinkType.UNSPECIFIED: 'unspecified'>)[source]¶ Add a link to the current node from the ‘src’ node. Both nodes must be a Node instance (or a subclass of Node)
Note: this function should not be called directly; it acts directly on the database.
Parameters: - src – the source object
- label (str) – the name of the label to set the link from src. Default = None.
-
_db_attrs
()[source]¶ Returns the keys of the attributes as a generator, directly from the DB.
DO NOT USE DIRECTLY.
-
_db_store
(with_transaction=True)[source]¶ Store a new node in the DB, also saving its repository directory and attributes.
After being called attributes cannot be changed anymore! Instead, extras can be changed only AFTER calling this store() function.
Note: After successful storage, those links that are in the cache, and for which also the parent node is already stored, will be automatically stored. The others will remain unstored.
Parameters: - with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
- use_cache (bool) – Whether I attempt to find an equal node in the DB.
-
_db_store_all
(with_transaction=True, use_cache=None)[source]¶ Store the node, together with all input links, if cached, and also the linked nodes, if they were not stored yet.
Parameters: with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
-
_del_db_attr
(key)[source]¶ Delete an attribute directly from the DB
DO NOT USE DIRECTLY.
Parameters: key – The key of the attribute to delete
-
_del_db_extra
(key)[source]¶ Delete an extra, directly on the DB.
DO NOT USE DIRECTLY.
Parameters: key – key name
-
_get_db_attr
(key)[source]¶ Return the attribute value, directly from the DB.
DO NOT USE DIRECTLY.
Parameters: key – the attribute key Returns: the attribute value Raises: AttributeError – if the attribute does not exist.
-
_get_db_description_field
()[source]¶ Get the description of this node, acting directly at the DB level
-
_get_db_extra
(key, *args)[source]¶ Get an extra, directly from the DB.
DO NOT USE DIRECTLY.
Parameters: key – key name Returns: the key value Raises: AttributeError – if the key does not exist
-
_get_db_input_links
(link_type)[source]¶ Return a list of tuples (label, aiida_class) for each input link, possibly filtering only by those of a given type.
Parameters: link_type – if not None, a link type to filter results Returns: a list of tuples (label, aiida_class)
-
_get_db_output_links
(link_type)[source]¶ Return a list of tuples (label, aiida_class) for each output link, possibly filtering only by those of a given type.
Parameters: link_type – if not None, a link type to filter results Returns: a list of tuples (label, aiida_class)
-
_get_dbcomments
(pk=None)[source]¶ Return a sorted list of DbComment associated with the Node.
Parameters: pk – integer or list of integers. If it is specified, returns the comment values with desired pks. (pk refers to DbComment.pk) Returns: the list of DbComment, sorted by pk.
-
_increment_version_number_db
()[source]¶ This function increments the version number in the DB. This should be called every time you need to increment the version (e.g. on adding a extra or attribute).
Note: Do not manually increment the version number, because if two different threads are adding/changing an attribute concurrently, the version number would be incremented only once.
-
_logger
= <logging.Logger object>¶
-
_plugin_type_string
= ''¶
-
_query_type_string
= ''¶
-
_remove_dblink_from
(label)[source]¶ Remove from the DB the input link with the given label.
Note: this function should not be called directly; it acts directly on the database.
Note: No checks are done to verify that the link actually exists.
Parameters: - label (str) – the label of the link from src to the current Node
- link_type – The type of link, must be one of the enum values form
LinkType
-
_replace_dblink_from
(src, label, link_type)[source]¶ Replace an input link with the given label and type, or simply creates it if it does not exist.
Note: this function should not be called directly; it acts directly on the database.
Parameters: - src (str) – the source object.
- label (str) – the label of the link from src to the current Node
- link_type – The type of link, must be one of the enum values form
LinkType
-
_reset_db_extras
(new_extras)[source]¶ Resets the extras (replacing existing ones) directly in the DB
DO NOT USE DIRECTLY!
Parameters: new_extras – dictionary with new extras
-
_set_db_attr
(key, value)[source]¶ Set the value directly in the DB, without checking if it is stored, or using the cache.
DO NOT USE DIRECTLY.
Parameters: - key (str) – key name
- value – its value
-
_set_db_computer
(computer)[source]¶ Set the computer directly inside the dbnode member, in the DB.
DO NOT USE DIRECTLY.
Parameters: computer – the computer object
-
_set_db_extra
(key, value, exclusive=False)[source]¶ Store extra directly in the DB, without checks.
DO NOT USE DIRECTLY.
Parameters: - key – key name
- value – key value
- exclusive – (default=False). If exclusive is True, it raises a UniquenessError if an Extra with the same name already exists in the DB (useful e.g. to “lock” a node and avoid to run multiple times the same computation on it).
-
_store_cached_input_links
(with_transaction=True)[source]¶ Store all input links that are in the local cache, transferring them to the DB.
Note: This can be called only if all parents are already stored. Note: Links are stored only after the input nodes are stored. Moreover, link storage is done in a transaction, and if one of the links cannot be stored, an exception is raised and all links will remain in the cache. Note: This function can be called only after the node is stored. After that, it can be called multiple times, and nothing will be executed if no links are still in the cache. Parameters: with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
-
_update_db_description_field
(field_value)[source]¶ Update the description of this node, acting directly at the DB level
-
add_comment
(content, user=None)[source]¶ Add a new comment.
Parameters: content – string with comment
-
copy
(**kwargs)[source]¶ Return a copy of the current object to work with, not stored yet.
This is a completely new entry in the DB, with its own UUID. Works both on stored instances and with not-stored ones.
Copies files and attributes, but not the extras. Does not store the Node to allow modification of attributes.
Returns: an object copy
-
ctime
¶
-
dbnode
¶
-
get_comments
(pk=None)[source]¶ Return a sorted list of comment values, one for each comment associated to the node.
Parameters: pk – integer or list of integers. If it is specified, returns the comment values with desired pks. (pk refers to DbComment.pk) Returns: the list of comments, sorted by pk; each element of the list is a dictionary, containing (pk, email, ctime, mtime, content)
-
get_computer
()[source]¶ Get the computer associated to the node.
Returns: the Computer object or None.
-
classmethod
get_subclass_from_pk
(pk)[source]¶ Get a node object from the pk, with the proper subclass of Node. (integer primary key used in this database), but loading the proper subclass where appropriate.
Parameters: pk – a string with the pk of the object to be loaded. Returns: the object of the proper subclass. Raise: NotExistent: if there is no entry of the desired object kind with the given pk.
-
classmethod
get_subclass_from_uuid
(uuid)[source]¶ Get a node object from the uuid, with the proper subclass of Node. (if Node(uuid=…) is called, only the Node class is loaded).
Parameters: uuid – a string with the uuid of the object to be loaded. Returns: the object of the proper subclass. Raise: NotExistent: if there is no entry of the desired object kind with the given uuid.
-
id
¶
-
mtime
¶
-
classmethod
query
(*args, **kwargs)[source]¶ Map to the aiidaobjects manager of the DbNode, that returns Node objects (or their subclasses) instead of DbNode entities.
# TODO: VERY IMPORTANT: the recognition of a subclass from the type # does not work if the modules defining the subclasses are not # put in subfolders. # In the future, fix it either to make a cache and to store the # full dependency tree, or save also the path.
-
type
¶
-
uuid
¶
-
-
class
aiida.orm.implementation.django.user.
User
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.user.AbstractUser
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.user'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
date_joined
¶
-
email
¶
-
first_name
¶
-
id
¶
-
institution
¶
-
is_active
¶
-
is_staff
¶
-
is_superuser
¶
-
last_login
¶
-
last_name
¶
-
pk
¶
-
classmethod
search_for_users
(**kwargs)[source]¶ Search for a user the passed keys.
Parameters: kwargs – The keys to search for the user with. Returns: A list of users matching the search criteria.
-
to_be_stored
¶
-
-
class
aiida.orm.implementation.django.user.
Util
[source]¶ Bases:
aiida.orm.implementation.general.user.Util
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.user'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
-
aiida.orm.implementation.django.utils.
get_db_columns
(db_class)[source]¶ This function returns a dictionary where the keys are the columns of the table corresponding to the db_class and the values are the column properties such as type, is_foreign_key and if so, the related table and column. :param db_class: the database model whose schema has to be returned :return: a dictionary
-
class
aiida.orm.implementation.django.workflow.
Workflow
(**kwargs)[source]¶ Bases:
aiida.orm.implementation.general.workflow.AbstractWorkflow
-
__init__
(**kwargs)[source]¶ Initializes the Workflow super class, store the instance in the DB and in case stores the starting parameters.
If initialized with an uuid the Workflow is loaded from the DB, if not a new workflow is generated and added to the DB following the stack frameworks. This means that only modules inside aiida.workflows are allowed to implements the workflow super calls and be stored. The caller names, modules and files are retrieved from the stack.
Parameters: - uuid – a string with the uuid of the object to be loaded.
- params – a dictionary of storable objects to initialize the specific workflow
Raise: NotExistent: if there is no entry of the desired workflow kind with the given uuid.
-
__module__
= 'aiida.orm.implementation.django.workflow'¶
-
_increment_version_number_db
()[source]¶ This function increments the version number in the DB. This should be called every time you need to increment the version (e.g. on adding a extra or attribute).
-
_update_db_description_field
(field_value)[source]¶ Safety method to store the description of the workflow
Returns: a string
-
_update_db_label_field
(field_value)[source]¶ Safety method to store the label of the workflow
Returns: a string
-
add_attribute
(_name, _value)[source]¶ Add one attributes to the Workflow. If another attribute is present with the same name it will be overwritten. :param name: a string with the attribute name to store :param value: a storable object to store
-
add_attributes
(_params)[source]¶ Add a set of attributes to the Workflow. If another attribute is present with the same name it will be overwritten. :param name: a string with the attribute name to store :param value: a storable object to store
-
add_result
(_name, _value)[source]¶ Add one result to the Workflow. If another result is present with the same name it will be overwritten. :param name: a string with the result name to store :param value: a storable object to store
-
add_results
(_params)[source]¶ Add a set of results to the Workflow. If another result is present with the same name it will be overwritten. :param name: a string with the result name to store :param value: a storable object to store
-
append_to_report
(text)[source]¶ Adds text to the Workflow report.
Note: Once, in case the workflow is a subworkflow of any other Workflow this method calls the parent append_to_report
method; now instead this is not the case anymore
-
clear_report
()[source]¶ Wipe the Workflow report. In case the workflow is a subworflow of any other Workflow this method calls the parent
clear_report
method.
-
ctime
¶
-
dbworkflowinstance
¶ Get the DbWorkflow object stored in the super class.
Returns: DbWorkflow object from the database
-
description
¶ Get the description of the workflow.
Returns: a string
-
get_attribute
(_name)[source]¶ Get one Workflow attribute :param name: a string with the attribute name to retrieve :return: a dictionary of storable objects
-
get_parameter
(_name)[source]¶ Get one Workflow paramenter :param name: a string with the parameters name to retrieve :return: a dictionary of storable objects
-
get_report
()[source]¶ Return the Workflow report.
Note: once, in case the workflow is a subworkflow of any other Workflow this method calls the parent get_report
method. This is not the case anymore.Returns: a list of strings
-
get_result
(_name)[source]¶ Get one Workflow result :param name: a string with the result name to retrieve :return: a dictionary of storable objects
-
get_state
()[source]¶ Get the Workflow’s state :return: a state from wf_states in aiida.common.datastructures
-
get_step
(step_method)[source]¶ Retrieves by name a step from the Workflow. :param step_method: a string with the name of the step to retrieve or a method :raise: ObjectDoesNotExist: if there is no step with the specific name. :return: a DbWorkflowStep object.
-
get_steps
(state=None)[source]¶ Retrieves all the steps from a specific workflow Workflow with the possibility to limit the list to a specific step’s state. :param state: a state from wf_states in aiida.common.datastructures :return: a list of DbWorkflowStep objects.
-
classmethod
get_subclass_from_dbnode
(wf_db)[source]¶ Loads the workflow object and reaoads the python script in memory with the importlib library, the main class is searched and then loaded. :param wf_db: a specific DbWorkflowNode object representing the Workflow :return: a Workflow subclass from the specific source code
-
classmethod
get_subclass_from_pk
(pk)[source]¶ Calls the
get_subclass_from_dbnode
selecting the DbWorkflowNode from the input pk. :param pk: a primary key index for the DbWorkflowNode :return: a Workflow subclass from the specific source code
-
classmethod
get_subclass_from_uuid
(uuid)[source]¶ Calls the
get_subclass_from_dbnode
selecting the DbWorkflowNode from the input uuid. :param uuid: a uuid for the DbWorkflowNode :return: a Workflow subclass from the specific source code
-
info
()[source]¶ Returns an array with all the informations about the modules, file, class to locate the workflow source code
-
is_subworkflow
()[source]¶ Return True is this is a subworkflow (i.e., if it has a parent), False otherwise.
-
label
¶ Get the label of the workflow.
Returns: a string
-
logger
¶ Get the logger of the Workflow object, so that it also logs to the DB.
Returns: LoggerAdapter object, that works like a logger, but also has the ‘extra’ embedded
-
pk
¶ Returns the DbWorkflow pk
-
classmethod
query
(*args, **kwargs)[source]¶ Map to the aiidaobjects manager of the DbWorkflow, that returns Workflow objects instead of DbWorkflow entities.
-
set_params
(params, force=False)[source]¶ Adds parameters to the Workflow that are both stored and used every time the workflow engine re-initialize the specific workflow to launch the new methods.
-
set_state
(state)[source]¶ Set the Workflow’s state :param name: a state from wf_states in aiida.common.datastructures
-
uuid
¶ Returns the DbWorkflow uuid
-
-
aiida.orm.implementation.django.workflow.
get_workflow_info
(w, tab_size=2, short=False, pre_string='', depth=16)[source]¶ Return a string with all the information regarding the given workflow and all its calculations and subworkflows. This is a recursive function (to print all subworkflows info as well).
Parameters: - w – a DbWorkflow instance
- tab_size – number of spaces to use for the indentation
- short – if True, provide a shorter output (only total number of calculations, rather than the state of each calculation)
- pre_string – string appended at the beginning of each line
- depth – the maximum depth level the recursion on sub-workflows will try to reach (0 means we stay at the step level and don’t go into sub-workflows, 1 means we go down to one step level of the sub-workflows, etc.)
Return lines: list of lines to be outputed