How to inspect an archive#
Note
This tutorial can be downloaded and run as a Jupyter Notebook: archive_profile.ipynb
, together with the archive process.aiida
.
The AiiDA archive is a file format for long term storage of data from a particular profile. See Sharing AiiDA archives for information on how to create and migrate an archive.
The easiest way to inspect the contents of an archive is to create a profile that “mounts” the archive as its data storage:
!verdi profile setup core.sqlite_zip -n --profile-name archive --filepath process.aiida
Warning: RabbitMQ server not reachable: Failed to connect with following connection parameters: {'protocol': 'amqp', 'username': 'guest', 'password': 'guest', 'host': '127.0.0.1', 'port': 5672, 'virtual_host': ''}.
Report: RabbitMQ can be reconfigured with `verdi profile configure-rabbitmq`.
Report: Initialising the storage backend.
Report: Storage initialisation completed.
Success: Created new profile `archive`.
Success: archive set as default profile
You can now inspect the contents of the process.aiida
archive by using the archive
profile in the same way you would a standard AiiDA profile.
For example, you can start an interactive shell using verdi -p archive shell
or if you are already in a notebook simply load the profile:
from aiida import load_profile
load_profile('archive', allow_switch=True)
Profile<uuid='384cb227010f4e59929d498f4b12a80f' name='archive'>
Warning
A profile using the core.sqlite_zip
storage is read-only.
It is therefore possible to query data, but trying to modify existing data or store new data will raise an exception.
Just as with a normal profile, we can now use the QueryBuilder
, to find and query for data:
from aiida import orm
process = orm.QueryBuilder().append(orm.ProcessNode).first(flat=True)
print(process)
uuid: cff1e914-5a34-4930-9429-9dcc6d38feb1 (pk: 61)
and also use Graph
, to visualize data provenance:
from aiida import orm
from aiida.tools.visualization import Graph
process = orm.QueryBuilder().append(orm.ProcessNode).first(flat=True)
graph = Graph(graph_attr={'rankdir': 'LR'})
graph.add_incoming(process, annotate_links='both')
graph.add_outgoing(process, annotate_links='both')
graph.graphviz
Once you are done inspecting the archive and you no longer want to keep the profile around, you can delete it:
verdi profile delete archive
You will be prompted whether you also want to keep the data.
If you want to keep the process.aiida
archive file, select not to delete the data.