9. Retrieving tutorial data

If you wish to retrieve the data which you have generated on your tutorial cloud machine, you can follow the steps below.

Note, these steps needs to be done for each AiiDA profile you wish to retrieve data from. In the following sections, we will be demonstrating this using the profile TUTORIAL_PROFILE.

Important

Shortly after the tutorial has ended we shall terminate your virtual machine, at which point the data will be irretrievable!

9.1. Save all Nodes in a Group and export

First, we store all Nodes from a profile into a Group for easy exporting:

$ verdi -p TUTORIAL_PROFILE shell
Python 3.6.9 ...
In[1]: nodes = QueryBuilder().append(Node).all(flat=True)

In[2]: all_nodes = Group("all_nodes").store()

In[3]: all_nodes.add_nodes(nodes)

In[4]: !verdi -p TUTORIAL_PROFILE export create -G {all_nodes.pk} -- my_tutorial_nodes.aiida
EXPORT
--------------  -----------------------
Archive         my_tutorial_nodes.aiida
Format          Zip (compressed)
Export version  0.9

Inclusion rules
-----------------  ----
...

The final stage of this process may take a number of minutes, at which time there is a progress bar to track the status of the export.

You will now have a new export archive my_tutorial_nodes.aiida in your current path. Note down this path, for example below we use the path: /home/max/my_tutorial_nodes.aiida.

9.2. Download exported archive

Open a new terminal on your local machine, then you can run the following:

$ scp aiidatutorial:/home/max/my_tutorial_nodes.aiida /path/to/archive/
my_tutorial_nodes.aiida ...

where /path/to/archive/ will be the path on your local machine where you want to download the archive to. Or you can cd to this path and instead use ./.

9.3. Import exported archive in your local AiiDA installation

You can now import the AiiDA archive like you have done all other archives during the tutorial, using verdi import:

$ verdi -p LOCAL_PROFILE import /path/to/archive/my_tutorial_nodes.aiida
Info: importing archive /path/to/archive/my_tutorial_nodes.aiida
...

Note that we are using the profile LOCAL_PROFILE here. This should be updated with the profile you wish to import the data into, on your local machine.

9.4. Success

You should have now successfully retrieved the complete database of the AiiDA profile TUTORIAL_PROFILE on your aiidatutorial host and imported it into your local AiiDA profile LOCAL_PROFILE.

Note

Remember to also copy over the scripts you wrote and saved in files either in your home folder or in a custom folder, using the same scp command used to copy the archive.

Important

Remember that all PKs will change, while the UUIDs will remain the same! So if you have taken notes of the PK numbers, convert them to UUIDs (on the tutorial machine you can use verdi node show <PK> to get the corresponding UUID).