Skip to content
Snippets Groups Projects
Commit f5f0830c authored by Athanasios Karmas's avatar Athanasios Karmas
Browse files

Changes to load tools transparently with the spack env modules and

parametrized even more the path that the JupyterLab kernel will be
created
parent ff3a36f7
No related branches found
No related tags found
No related merge requests found
#!/bin/bash #!/bin/bash
#title :create_JupyterLab_kernel.sh #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. #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 #usage :./create_JupyterLab_kernel.sh $INSTALLATION_ROOT $ENV $LAB_KERNEL_PATH
#============================================================================== #==============================================================================
INSTALLATION_ROOT=$1 INSTALLATION_ROOT=$1
SPACKIFIED_ENV=$2 SPACKIFIED_ENV=$2
CONF_PATH="/srv/jupyterlab_kernels/int/release20210930" LAB_KERNEL_PATH=$3
# load spack and spack repos # load spack and spack repos
cp -r /srv/$INSTALLATION_ROOT/spack/.spack ~ cp -r /srv/$INSTALLATION_ROOT/spack/.spack ~
...@@ -14,26 +14,26 @@ source /srv/$INSTALLATION_ROOT/spack/share/spack/setup-env.sh ...@@ -14,26 +14,26 @@ source /srv/$INSTALLATION_ROOT/spack/share/spack/setup-env.sh
spack repo add /srv/$INSTALLATION_ROOT/ebrains-spack-builds spack repo add /srv/$INSTALLATION_ROOT/ebrains-spack-builds
# prepare the env file # prepare the env file
mkdir $CONF_PATH/bin mkdir $LAB_KERNEL_PATH/bin
cat <<EOF > $CONF_PATH/bin/env.sh cat <<EOF > $LAB_KERNEL_PATH/bin/env.sh
#!/usr/bin/env bash #!/usr/bin/env bash
set -euxo pipefail set -euxo pipefail
EOF EOF
# load here all tools # 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 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 >> $LAB_KERNEL_PATH/bin/env.sh
#spack env activate $SPACKIFIED_ENV --sh >> $CONF_PATH/bin/env.sh #spack env activate $SPACKIFIED_ENV --sh >> $LAB_KERNEL_PATH/bin/env.sh
# end of env creation # end of env creation
cat <<EOF >>$CONF_PATH/bin/env.sh cat <<EOF >>$LAB_KERNEL_PATH/bin/env.sh
python -m ipykernel_launcher -f \$@ python -m ipykernel_launcher -f \$@
EOF EOF
chmod +x $CONF_PATH/bin/env.sh chmod +x $LAB_KERNEL_PATH/bin/env.sh
# create the new kernel's configuration file # create the new kernel's configuration file
mkdir $CONF_PATH/spack_python_kernel_release_20210930 mkdir $LAB_KERNEL_PATH/spack_python_kernel_release_20210930
cat <<EOF >$CONF_PATH/spack_python_kernel_release_20210930/kernel.json cat <<EOF >$LAB_KERNEL_PATH/spack_python_kernel_release_20210930/kernel.json
{ {
"argv": ["$CONF_PATH/bin/env.sh", "{connection_file}"], "argv": ["$LAB_KERNEL_PATH/bin/env.sh", "{connection_file}"],
"display_name": "EBRAINS_release_20210930", "display_name": "EBRAINS_release_20210930",
"name": "spack_python_kernel_release_20210930", "name": "spack_python_kernel_release_20210930",
"language": "python" "language": "python"
......
...@@ -8,13 +8,17 @@ ...@@ -8,13 +8,17 @@
echo "Setting up environment..." echo "Setting up environment..."
cp -r /srv/test-build/spack/.spack ~ INSTALLATION_ROOT="test-build"
source /srv/test-build/spack/share/spack/setup-env.sh SPACKIFIED_ENV="ebrains-spack-builds"
cd /srv/test-build/ cp -r /srv/$INSTALLATION_ROOT/spack/.spack ~
source /srv/$INSTALLATION_ROOT/spack/share/spack/setup-env.sh
cd /srv/$INSTALLATION_ROOT
spack repo add ebrains-spack-builds spack repo add ebrains-spack-builds
spack env activate ebrains-spack-builds spack env activate $SPACKIFIED_ENV
module use /srv/$INSTALLATION_ROOT/spack/share/spack/modules/linux-centos7-broadwell/
source /srv/$INSTALLATION_ROOT/spack/var/spack/environments/$SPACKIFIED_ENV/loads
echo "Everything ready!" echo "Everything ready!"
#echo "Starting Python..."
#python
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment