Select Git revision
create_JupyterLab_kernel.sh
Forked from
EBRAINS RI / Tech Hub / Platform / EBRAINS Software Distribution / ebrains-spack-builds
1924 commits behind the upstream repository.
Athanasios Karmas authored
create_JupyterLab_kernel.sh 1.23 KiB
#!/bin/bash
#title :create_JupyterLab_kernel.sh
#description :Script to create a spackified JupyterLab kernel conf and place it to NFS where it can be loaded by all users.
#usage :./create_JupyterLab_kernel.sh $BUILD-ENV
#==============================================================================
ENV=$1
CONF_PATH="/srv/$ENV/ebrains-spack-builds"
# load spack and spack repos
cp -r /srv/$ENV/spack/.spack ~
source /srv/$ENV/spack/share/spack/setup-env.sh
spack repo add $CONF_PATH
# prepare the env file
mkdir $CONF_PATH/bin
cat <<EOF > $CONF_PATH/bin/env.sh
#!/usr/bin/env bash
set -euxo pipefail
EOF
# load here all tools
spack load --sh -r nest@3.0 \
py-ipykernel \
%gcc@10.3.0 >>$CONF_PATH/bin/env.sh
# end of env creation
cat <<EOF >>$CONF_PATH/bin/env.sh
python -m ipykernel_launcher -f \$@
EOF
chmod +x $CONF_PATH/bin/env.sh
# create the new kernel's configuration file
mkdir $CONF_PATH/spack_python_kernel_release_20210930
cat <<EOF >$CONF_PATH/spack_python_kernel_release_20210930/kernel.json
{
"argv": ["$CONF_PATH/bin/env.sh", "{connection_file}"],
"display_name": "EBRAINS_release_20210930",
"name": "spack_python_kernel_release_20210930",
"language": "python"
}
EOF