diff --git a/create_kernel.sh b/create_kernel.sh new file mode 100755 index 0000000000000000000000000000000000000000..a741e3cdcbf25be2d945164550926c5b816a2256 --- /dev/null +++ b/create_kernel.sh @@ -0,0 +1,3 @@ +#!/bin/bash +mkdir -p ~/.local/share/jupyter/kernels/singularity_docker_jupyter +sed -e "s|/path/to|$PWD|" ./jupyter-jsc/kernel.json > ~/.local/share/jupyter/kernels/singularity_docker_jupyter/kernel.json diff --git a/example_submission_script.sh b/example_submission_script.sh new file mode 100644 index 0000000000000000000000000000000000000000..d8aa296c7d47789cee8075bd5bbf1764caa57170 --- /dev/null +++ b/example_submission_script.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#SBATCH --nodes=1 +#SBATCH --ntasks-per-node=1 +#SBATCH --time=00:01:00 +#SBATCH --partition=batch +#SBATCH --account=atmlaml + +module load Singularity-Tools +echo "-------- Outside of the container -----------" +python src/hello_world.py +echo "-------- Inside of the container ------------" +singularity run singularity_docker_jupyter.sif python3 src/hello_world.py +echo "--------------------------------------------" diff --git a/jupyter-jsc/kernel.json b/jupyter-jsc/kernel.json new file mode 100644 index 0000000000000000000000000000000000000000..b4d6e824440709879deac382769a7a29b910dfcd --- /dev/null +++ b/jupyter-jsc/kernel.json @@ -0,0 +1,9 @@ +{ + "argv": [ + "/path/to/jupyter-jsc/kernel.sh", + "-f", + "{connection_file}" + ], + "display_name": "singularity_docker_jupyter", + "language": "python" +} diff --git a/jupyter-jsc/kernel.sh b/jupyter-jsc/kernel.sh new file mode 100755 index 0000000000000000000000000000000000000000..d4a50959260358dcf56d529d0b897585d3c62ea1 --- /dev/null +++ b/jupyter-jsc/kernel.sh @@ -0,0 +1,5 @@ +#!/bin/bash +SOURCE_PATH=`dirname ${BASH_SOURCE}` +module purge +module load Singularity-Tools +exec singularity run ${SOURCE_PATH}/../singularity_docker_jupyter.sif python3 -m ipykernel "$@" diff --git a/src/hello_world.py b/src/hello_world.py new file mode 100644 index 0000000000000000000000000000000000000000..24a9c83dcc5741cfb70f163fc4f083814e7275cc --- /dev/null +++ b/src/hello_world.py @@ -0,0 +1,5 @@ + +import sys +print("Hello world. This is my Python version:") +print(sys.version) +