Skip to content

Commit 85a84fc

Browse files
authored
Doc: Add StashCalculation explanation to RTD (#6861)
1 parent ee87c79 commit 85a84fc

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

docs/source/topics/calculations/usage.rst

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -632,17 +632,46 @@ Using the ``COPY`` mode, the target path defines another location (on the same f
632632
}
633633
634634
.. note::
635+
In addition to the ``COPY`` mode, the following modes, these storage efficient modes are also are available:
636+
``COMPRESS_TAR``, ``COMPRESS_TARBZ2``, ``COMPRESS_TARGZ``, ``COMPRESS_TARXZ``.
635637
636-
In the future, other methods for stashing may be implemented, such as placing all files in a (compressed) tarball or even stash files on tape.
638+
The stashed files and folders are represented by an output node that is attached to the calculation node through the label ``remote_stash``, as a ``RemoteStashFolderData`` node.
639+
Just like the ``remote_folder`` node, this represents a location or files on a remote machine and so is equivalent to a "symbolic link".
637640
638641
.. important::
639642
640-
If the ``stash`` option namespace is defined for a calculation job, the daemon will perform the stashing operations before the files are retrieved.
643+
If the ``stash`` option namespace is defined for a generic calculation job, the daemon will perform the stashing operations before the files are retrieved.
641644
This means that the stashing happens before the parsing of the output files (which occurs after the retrieving step), such that that the files will be stashed independent of the final exit status that the parser will assign to the calculation job.
642645
This may cause files to be stashed for calculations that will later be considered to have failed.
643646
644-
The stashed files and folders are represented by an output node that is attached to the calculation node through the label ``remote_stash``, as a ``RemoteStashFolderData`` node.
645-
Just like the ``remote_folder`` node, this represents a location or files on a remote machine and so is equivalent to a "symbolic link".
647+
To avoid this scenario, you can instead, stash via a separate calculation job, for example:
648+
649+
.. code-block:: python
650+
651+
from aiida.common.datastructures import StashMode
652+
from aiida.orm import load_node, load_computer
653+
654+
StashCalculation = CalculationFactory('core.stash')
655+
656+
calcjob_node = load_node(<CALCJOB_PK>)
657+
remote_folder = calcjob_node.outputs.remote_folder
658+
659+
inputs = {
660+
'metadata': {
661+
'computer': load_computer(label="localhost"),
662+
'options': {
663+
'stash': {
664+
'source_list': ['aiida.out', 'output.txt'],
665+
'target_base': '/scratch/',
666+
'stash_mode': StashMode.COPY.value,
667+
},
668+
},
669+
},
670+
'source_node': remote_folder,
671+
}
672+
673+
result = run(StashCalculation, **inputs)
674+
646675
647676
.. important::
648677

src/aiida/calculations/stash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class StashCalculation(CalcJob):
2626
2727
inputs = {
2828
'metadata': {
29-
'computer': Computer.collection.get(label="localhost"),
29+
'computer': load_computer(label="localhost"),
3030
'options': {
3131
'resources': {'num_machines': 1},
3232
'stash': {

0 commit comments

Comments
 (0)