aiida.backends.general.migrations package

Submodules

Data structures for mapping legacy JobCalculation data to new process attributes.

class aiida.backends.general.migrations.calc_state.StateMapping(state, process_state, exit_status, process_status)

Bases: tuple

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__module__ = 'aiida.backends.general.migrations.calc_state'
static __new__(_cls, state, process_state, exit_status, process_status)

Create new instance of StateMapping(state, process_state, exit_status, process_status)

__repr__()

Return a nicely formatted representation string

__slots__ = ()
_asdict()

Return a new OrderedDict which maps field names to their values.

_fields = ('state', 'process_state', 'exit_status', 'process_status')
_fields_defaults = {}
classmethod _make(iterable)

Make a new StateMapping object from a sequence or iterable

_replace(**kwds)

Return a new StateMapping object replacing specified fields with new values

exit_status

Alias for field number 2

process_state

Alias for field number 1

process_status

Alias for field number 3

state

Alias for field number 0

SQL statements to detect invalid/ununderstood links for the provenance redesign migration.

Various utils that should be used during migrations and migrations tests because the AiiDA ORM cannot be used.

aiida.backends.general.migrations.utils.delete_numpy_array_from_repository(uuid, name)[source]

Delete the numpy array with a given name from the repository corresponding to a node with a given uuid.

Parameters:
  • uuid – the UUID of the node
  • name – the name of the numpy array
aiida.backends.general.migrations.utils.dumps_json(dictionary)[source]

Transforms all datetime object into isoformat and then returns the JSON.

aiida.backends.general.migrations.utils.ensure_repository_folder_created(uuid)[source]

Make sure that the repository sub folder for the node with the given UUID exists or create it.

Parameters:uuid – UUID of the node
aiida.backends.general.migrations.utils.get_node_repository_sub_folder(uuid)[source]

Return the absolute path to the sub folder path within the repository of the node with the given UUID.

Parameters:uuid – UUID of the node
Returns:absolute path to node repository folder, i.e /some/path/repository/node/12/ab/c123134-a123/path
aiida.backends.general.migrations.utils.get_numpy_array_absolute_path(uuid, name)[source]

Return the absolute path of a numpy array with the given name in the repository of the node with the given uuid.

Parameters:
  • uuid – the UUID of the node
  • name – the name of the numpy array
Returns:

the absolute path of the numpy array file

aiida.backends.general.migrations.utils.get_object_from_repository(uuid, name)[source]

Return the content of a file with the given name in the repository sub folder of the given node.

Parameters:
  • uuid – UUID of the node
  • name – name to use for the file
aiida.backends.general.migrations.utils.load_numpy_array_from_repository(uuid, name)[source]

Load and return a numpy array from the repository folder of a node.

Parameters:
  • uuid – the node UUID
  • name – the name under which to store the array
Returns:

the numpy array

aiida.backends.general.migrations.utils.put_object_from_string(uuid, name, content)[source]

Write a file with the given content in the repository sub folder of the given node.

Parameters:
  • uuid – UUID of the node
  • name – name to use for the file
  • content – the content to write to the file
aiida.backends.general.migrations.utils.recursive_datetime_to_isoformat(value)[source]

Convert all datetime objects in the given value to string representations in ISO format.

Parameters:value – a mapping, sequence or single value optionally containing datetime objects
aiida.backends.general.migrations.utils.store_numpy_array_in_repository(uuid, name, array)[source]

Store a numpy array in the repository folder of a node.

Parameters:
  • uuid – the node UUID
  • name – the name under which to store the array
  • array – the numpy array to store