.. raw:: html
Foldspace
Foldspace allows to schedule and run web services on compute nodes of CINECA HPC clusters, and to access them via your local browser. Currently the web services provided are Jupyter, MLflow, Code server and VNC.
How to install Foldspace
^^^^^^^^^^^^^^^^^^^^^^^^
Foldspace can be installed via ``pip``, provided that the following requirements are satisfied:
- OS: GNU/Linux, MacOS or Windows (`WSL `_ suggested);
- to have completed all the steps for the `ssh access `_ to CINECA clusters;
- to have an active Project Account on the cluster you want to access with Foldspace;
- Python: version 3.8 or greater
We suggest to create a Python virtual environment for Foldspace installation; in the examples below, for the sake of clarity, we will create a `foldspace_venv` virtual environment in your $HOME folder as an example:
.. code:: bash
python3 -m venv $HOME/foldspace_venv # or you can choose any path you like
source $HOME/foldspace_venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install foldspace
This enable the ``foldspace`` command in your shell.
.. note::
To use the ``foldspace`` command in future sessions, simply **activate** the Python environment. For instance, following the Bash example above, run:
.. code:: bash
source $HOME/foldspace_venv/bin/activate
Foldspace can be used as described in the next sections.
How to use Foldspace
^^^^^^^^^^^^^^^^^^^^
Foldspace allows to schedule and run web services on compute nodes of a CINECA HPC clusters, and to access them from your local browser. Behind the scenes, this is achieved submitting a job in which a web server will run, and forwarding the server port on the compute node to your local host, via ssh. Thus you will need to specify to Foldspace:
* which cluster you want to use
* which web service you want to start (i.e. which job you want to submit among the availiable ones)
* any (optional) additional option for the job (i.e. walltime, number of tasks, number of nodes, partition, gpus...)
The general syntax to access the web services (`tools`) provided by Foldspace is the following:
.. code:: bash
foldspace --user --cluster --tool [any slurm directive you like]
and the values allowed for the options are the following:
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| Option | Value | References |
+==============================+==========================================================+=====================================================================================================+
| ``--user`` | `your username on CINECA clusters` | |
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| ``--cluster`` | leonardo | :ref:`Leonardo ` |
+ +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| | g100 | :ref:`Galileo100 ` |
+ +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| | pitagora | :ref:`Pitagora ` |
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| ``--tool`` | jupyter-latest | `Jupyter official website `_ |
+ +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| | codeserver | `Code Server official repo `_ |
+ +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| | mlflow | `MLflow official website `_ |
+ +----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| | vnc | `noVNC official website `_ |
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
| [optional slurm directives] | `You can tune the resources of` | |
| | | |
| | `your server job passing to` | `Main Slurm Directives `_ |
| | | |
| | `foldspace any slurm directive` | |
+------------------------------+----------------------------------------------------------+-----------------------------------------------------------------------------------------------------+
To better clarify, here is a list of examples of possible commands you might want to run:
* Start Code Server on Galileo100 for 2 hours:
.. code:: bash
foldspace --user --cluster g100 --tool codeserver --time 02:00:00
* Start Jupyter on Leonardo Booster partition using 4 tasks and a GPU for 90 minutes:
.. code:: bash
foldspace --user --cluster leonardo --tool jupyter-latest --partition boost_usr_prod --ntasks 4 --gres gpu:1 --time 01:30:00
# or simply -p boost_usr_prod --n 4 --gres gpu:1 -t 01:30:00
* Start a VNC interface on Pitagora DCGP partition using a single task (default) and a specific Project Account:
.. code:: bash
foldspace --user --cluster pitagora --tool vnc --partition dcgp_fua_prod --account
.. note::
If no options are specified, the default configuration is a job with a 30-minute walltime and a single CPU on the *serial* partition; therefore, you may want to specify at least the ``--time`` option.
When you launch the ``foldspace`` command, an SSH certificate will be implicitly requested as in :ref:`general/access:How to configure *smallstep* client`, so a browser page will be opened to insert your HPC credentials and your OTP. Then Foldspace will submit the job, and as soon as the job will be running it will show a link to be opened in your browser, as well as temporary credentials to access your server if needed. Here below, you can find an example of a typical Foldspace execution:
.. image:: img/foldspace_example_01.png
:alt: Workflow example of Foldspace execution
:width: 420px
:align: center
.. tip::
Although the tunneled services utilize the HTTP protocol, all traffic is **fully encrypted** through the SSH tunnel.
When you want to **quit**, follow the instructions in the terminal and then press **Enter**. You will be asked to choose among
- **cancel** the job
- **disconnect** to the server but keep the job running, so that you can connect to it once again from a different shell before the job walltime is reached.
.. image:: img/foldspace_example_02.png
:alt: Example of disconnection from a Foldspace tool
:width: 300px
:align: center
To **re-connect** to a running job, just run
.. code:: bash
foldspace --user --cluster
.. image:: img/foldspace_example_03.png
:alt: Example of reconnection to a Foldspace tool
:width: 500px
:align: center
.. warning::
Please note that while you are disconnected the job is still running, so you are still using the budget of your Project Account for computational resources.
.. tip::
All the **logs** of the tools are stored in ``$HOME/.foldspace/sessions``. If you need, you can safely delete the ``$HOME/.foldspace`` directory when no Foldpsace tools are running. Please do not redirect your job output and errors via the ``--output`` and ``--error`` Slurm options, since it may compromise the foldspace expected behaviour.
Available tools
^^^^^^^^^^^^^^^
.. toctree::
:maxdepth: 1
:hidden:
tools/jupyter
tools/codeserver
tools/mlflow
tools/vnc
.. grid:: 2
.. grid-item-card::
:link: jupyter_tool_card
:link-type: ref
:text-align: center
|logo_jupyter|
**Jupyter**
.. grid-item-card::
:link: codeserver_tool_card
:link-type: ref
:text-align: center
|logo_code-server|
**Code server**
.. grid:: 2
.. grid-item-card::
:link: mlflow_tool_card
:link-type: ref
:text-align: center
|logo_mlflow|
**MLflow**
.. grid-item-card::
:link: vnc_tool_card
:link-type: ref
:text-align: center
|logo_novnc|
**VNC**
.. |logo_jupyter| image:: /foldspace/img/logo_jupyter.png
:width: 138px
:class: no-scaled-link
.. |logo_code-server| image:: /foldspace/img/logo_code-server.png
:width: 72px
:class: no-scaled-link
.. |logo_mlflow| image:: /foldspace/img/logo_mlflow.png
:width: 48px
:class: no-scaled-link
.. |logo_novnc| image:: /foldspace/img/logo_novnc.png
:width: 46px
:class: no-scaled-link