#!/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 #============================================================================== INSTALLATION_ROOT=$1 SPACKIFIED_ENV=$2 CONF_PATH="/srv/jupyterlab_kernels/int/release20210930" # load spack and spack repos cp -r /srv/$INSTALLATION_ROOT/spack/.spack ~ source /srv/$INSTALLATION_ROOT/spack/share/spack/setup-env.sh spack repo add /srv/$INSTALLATION_ROOT/ebrains-spack-builds # 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 python@3.8.11 py-ipykernel py-pip py-numpy@1.21.0 py-scipy py-pandas py-seaborn py-matplotlib arbor nest@3.0 neuron py-pynn tvb-data tvb-library %gcc@10.3.0 >> $CONF_PATH/bin/env.sh spack env activate $SPACKIFIED_ENV --sh >> $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