In this tutorial you will learn how to launch a remote interactive session on Jupyter Notebook using
You will be using two machines. A local one, where you will be using an interactive session of Jupyter, and a remote machine,
clearml-agent will run and spin an instance of the remote session.
clearml-sessionpackage installed (
pip install clearml-session)
- At least one
clearml-agentrunning on a remote host. See installation details. Configure the
clearml-agentto listen to the
clearml-agent daemon --queue default)
- An SSH client installed on machine being used. To verify, open terminal, execute
ssh, and if no error is received, it should be good to go.
Step 1: Launch
Execute the following command:
clearml-session --docker nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04 --packages "clearml" "tensorflow>=2.2" "keras" --queue default
This sets the following arguments:
--docker nvidia/cuda:10.1-cudnn7-runtime-ubuntu18.04- Docker image
--packages "clearml" "tensorflow>=2.2" "keras"- Required Python packages
--queue default- Selected queue to launch the session from
Enter a project name using
--project <name>. If no project is input, the default project
name is "DevOps"
After launching the command, the
clearml-agent listening to the
default queue spins a remote Jupyter environment with
the specifications. It will automatically connect to the docker on the remote machine.
The console should display the session's configuration details, which should look something like this:
Interactive session config:
Step 2: Launch Interactive Session
When the CLI asks whether to
Launch interactive session [Y]/n?, press 'Y' or 'Enter'.
The terminal should output information regarding the status of the environment-building process, which should look something like this:
Creating new session
New session created [id=35c0af81ae6541589dbae1efb747f388]
Waiting for remote machine allocation [id=35c0af81ae6541589dbae1efb747f388]
Remote machine allocated
Setting remote environment [Task id=35c0af81ae6541589dbae1efb747f388]
Setup process details: https://app.clear.ml/projects/60893b87b0b642679fde00db96e90359/experiments/35c0af81ae6541589dbae1efb747f388/output/log
Waiting for environment setup to complete [usually about 20-30 seconds]
Step 3: Connect to Remote Notebook
Then the CLI will output a link to the ready environment:
Interactive session is running:
SSH: ssh root@localhost -p 8022 [password: c5d19b3c0fa9784ba4f6aeb568c1e036a4fc2a4bc7f9bfc54a2c198d64ceb9c8]
Jupyter Lab URL: http://localhost:8878/?token=ff7e5e8b9e5493a01b1a72530d18181320630b95f442b419
VSCode server available at http://localhost:8898/
Click on the JupyterLab link, which will open the remote session
Now, let's execute some code in the remote session!
Step 4: Execute Code
Open up a new Notebook.
In the first cell of the notebook, clone the ClearML repository:
!git clone https://github.com/allegroai/clearml.git
In the second cell of the notebook, run this script from the cloned repository:
Look in the script, and notice that it makes use of ClearML, Keras, and TensorFlow, but you don't need to install these packages in Jupyter, because you specified them in the
Step 5: Shut Down Remote Session
To shut down the remote session, which will free the
clearml-agent and close the CLI, enter "Shutdown".
Connection is up and running
Enter "r" (or "reconnect") to reconnect the session (for example after suspend)
Ctrl-C (or "quit") to abort (remote session remains active)
or "Shutdown" to shutdown remote interactive session