<commit_before>.. _userguide:

User guide
==========

Environment variables
---------------------

REANA_SERVER_URL
~~~~~~~~~~~~~~~~

You can set this environment variable in order to specify to which REANA cloud
instance your client should connect and a valid token. For example:

.. code-block:: console

   $ export REANA_SERVER_URL=https://reana.cern.ch

REANA_ACCESS_TOKEN
~~~~~~~~~~~~~~~~~~

You should specify valid access token for the REANA cloud instance you would
like to use. For example:

.. code-block:: console

   $ export REANA_ACCESS_TOKEN=XXXXXXX

The token should have been given to you by the REANA cluster administrators.

REANA_WORKON
~~~~~~~~~~~~

You can set this environment variable in order to specify a concrete workflow
you would like to work on. (As an alternative to specifying ``--workflow``
option in commands.) For example:

.. code-block:: console

   $ export REANA_WORKON=myfirstanalysis

will work on the latest run of your "myfirstanalysis" workflow.

Note that you can also specify a concrete run number:

.. code-block:: console

   $ export REANA_WORKON=myfirstanalysis.3

which will permit to work on the third run of the "myfirstanalysis" workflow,
for example to check out past input and output files.

You can list all your workflow runs and their statuses by doing:

.. code-block:: console

   $ reana-client workflows

and set ``REANA_WORKON`` to the one you would like to work on.

Usage
-----

Overview
~~~~~~~~

Please see the :ref:`gettingstarted` section for a basic ``reana-client`` use
case scenario.

Uploading analysis assets
~~~~~~~~~~~~~~~~~~~~~~~~~

Uploading files or directories to an analysis workspace is simple as:

.. code-block:: console

   $ reana-client upload file1 file2 directory1
   File file1 was successfully uploaded.
   File file2 was successfully uploaded.
   File directory1/file3 was successfully uploaded.

If you want to upload all input files defined in the reana.yaml of the analysis,
you can just run:

.. code-block:: console

   $ reana-client upload
   File file1 was successfully uploaded.
   File file2 was successfully uploaded.

Directory structures are maintained, i.e.
directory1 exists in the workspace.

Note that symbolic links are resolved at the moment of upload
so that a hard copy of the link target is uploaded to the cloud
storage workspace. The link is not maintained throughout the
workflow execution.


Deleting analysis assets
~~~~~~~~~~~~~~~~~~~~~~~~

The deletion of files contained in the analysis workspace is possible through
the ``remove`` command:

.. code-block:: console

   $ reana-client remove file1
   File file1 was successfully deleted.
   19 bytes freed up.

If you want to delete more than one file at once it is possible to use
globbing:

.. code-block:: console

   $ reana-client remove '**/file*'
   File file1 was successfully deleted.
   File file2 was successfully deleted.
   File directory1/file3 was successfully deleted.
   240 bytes freed up.<commit_msg>docs: harmonise example file names<commit_after>.. _userguide:

User guide
==========

Environment variables
---------------------

REANA_SERVER_URL
~~~~~~~~~~~~~~~~

You can set this environment variable in order to specify to which REANA cloud
instance your client should connect and a valid token. For example:

.. code-block:: console

   $ export REANA_SERVER_URL=https://reana.cern.ch

REANA_ACCESS_TOKEN
~~~~~~~~~~~~~~~~~~

You should specify valid access token for the REANA cloud instance you would
like to use. For example:

.. code-block:: console

   $ export REANA_ACCESS_TOKEN=XXXXXXX

The token should have been given to you by the REANA cluster administrators.

REANA_WORKON
~~~~~~~~~~~~

You can set this environment variable in order to specify a concrete workflow
you would like to work on. (As an alternative to specifying ``--workflow``
option in commands.) For example:

.. code-block:: console

   $ export REANA_WORKON=myfirstanalysis

will work on the latest run of your "myfirstanalysis" workflow.

Note that you can also specify a concrete run number:

.. code-block:: console

   $ export REANA_WORKON=myfirstanalysis.3

which will permit to work on the third run of the "myfirstanalysis" workflow,
for example to check out past input and output files.

You can list all your workflow runs and their statuses by doing:

.. code-block:: console

   $ reana-client workflows

and set ``REANA_WORKON`` to the one you would like to work on.

Usage
-----

Overview
~~~~~~~~

Please see the :ref:`gettingstarted` section for a basic ``reana-client`` use
case scenario.

Uploading analysis assets
~~~~~~~~~~~~~~~~~~~~~~~~~

Uploading files or directories to an analysis workspace is simple as:

.. code-block:: console

   $ reana-client upload mydata.csv mycode.C mytmp
   File mydata.csv was successfully uploaded.
   File mycode.C was successfully uploaded.
   File mytmp/myfiltereddata.csv was successfully uploaded.

If you want to upload all input files defined in the reana.yaml of the analysis,
you can just run:

.. code-block:: console

   $ reana-client upload
   File mydata.csv was successfully uploaded.
   File mycode.C was successfully uploaded.

Directory structures are maintained, i.e.
mytmp exists in the workspace.

Note that symbolic links are resolved at the moment of upload
so that a hard copy of the link target is uploaded to the cloud
storage workspace. The link is not maintained throughout the
workflow execution.


Deleting analysis assets
~~~~~~~~~~~~~~~~~~~~~~~~

The deletion of files contained in the analysis workspace is possible through
the ``remove`` command:

.. code-block:: console

   $ reana-client remove mydata.csv
   File mydata.csv was successfully deleted.
   25356 bytes freed up.

If you want to delete more than one file at once it is possible to use
globbing:

.. code-block:: console

   $ reana-client remove '**/*.csv'
   File mydata.csv was successfully deleted.
   File mytmp/myfiltereddata.csv was successfully deleted.
   79736 bytes freed up.
{'fraction_non_alphanumeric': 0.0980555093900615, 'fraction_numerical': 0.005484460694698354, 'mean_word_length': 3.892682926829268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2836034', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1555, 'n_words': 766}