-
Notifications
You must be signed in to change notification settings - Fork 4
Create Script Templates
Marcel-Brian Wilkowsky edited this page Nov 7, 2022
·
3 revisions
Script templates will be used to remotely create Jupyter kernels as automatically as possible.
The script template is structured as follows:
INPUT_1=Load required software;module load lang Python
INPUT_2=Location to install;$HOME
Syntax: INPUT_<VAR NUM>=<TITLE>;<DEFAULT VALUE>
This INPUT variables will be used to create $X variables which will be used later inside the script:
$1
python3 -m venv $2/ipython_venv
source $2/ipython_venv/bin/activate
python3 -m pip install ipython ipykernel
deactivate
echo -e '#!/bin/bash\n$1\nsource $2/ipython_venv/bin/activate\n"$@"' > $2/ipython_venv/ipy_wrapper.sh
chmod +x $2/ipython_venv/ipy_wrapper.sh
This is the actual script which will be executed remotely. The INPUT variables will be used here to add variable values to the script.
KERNEL_LANGUAGE=python
KERNEL_CMD=$2/ipython_venv/ipy_wrapper.sh ipython kernel -f {connection_file}
The KERNEL_ flags will be used to create local Jupyter kernels.
Available are: KERNEL_LANGUAGE, KERNEL_CMD, KERNEL_ENVIRONMENT, KERNEL_DISPLAYNAME