First of all you will need to login to Balena.
You will need to submit a jobscript to launch the session. You can download and copy this example jobscript to Balena, or just create a file along the lines of the following.
#!/bin/bash
#SBATCH --partition=batch
#SBATCH --job-name="notebook"
#SBATCH --output=job.notebook.%j
#SBATCH --nodes=1
## 30 mintues
#SBATCH --time=30
module load python3/2019.x
echo "URL to CONNECT for JOB $SLURM_JOB_ID is http://$(host $(hostname) | awk 'NF>1{print $NF}')"
jupyter notebook --ip="*" --no-browser
The jobscript interacts with the scheduler in exactly the same way as any other job so if you wanted to run longer jobs or use a premium account you just need to modify/enter the appropriate #SBATCH
instructions in the file.
The Jupyter Notebook output that printed to screen in the interactive case printed to screen will now be output to the file job.notebook.%j
where %j
is the jobid in the scheduler. If you do not use the provided jobscript, and do not specify the name of the output #SBATCH --output=output_file
then the output will default to slurm-<jobid>.out
.
You should search the file for the IP address and the port with e.g.:
grep "CONNECT\|http" job.notebook.<jobid>
which will give output similar to:
URL to CONNECT for JOB 2454254 is http://172.30.4.165
[I 10:27:03.417 NotebookApp] http://[all ip addresses on your system]:8888/
when the job has started and the Jupyter notebook server has launched successfully.
You can now access the notebook server by opening a web browser on your local machine and, in this case above entering the address:
http://172.30.4.165:8888
If you have follwed the tutorial successfully you should be prompted for the password you entered in the previous episode, running interactively , and be launched into the familar Jupyter notebooks environment.