forked from farakiko/boostedhiggs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
44 lines (36 loc) · 1.33 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
cat <<EOF > shell
#!/usr/bin/env bash
if [ "\$1" == "" ]; then
export COFFEA_IMAGE=coffeateam/coffea-dask:latest
else
export COFFEA_IMAGE=\$1
fi
singularity exec -B \${PWD}:/srv -B /uscmst1b_scratch --pwd /srv \\
/cvmfs/unpacked.cern.ch/registry.hub.docker.com/\${COFFEA_IMAGE} \\
/bin/bash --rcfile /srv/.bashrc
EOF
cat <<EOF > .bashrc
install_env() {
set -e
echo "Installing shallow virtual environment in \$PWD/.env..."
python -m venv --without-pip --system-site-packages .env
unlink .env/lib64 # HTCondor can't transfer symlink to directory and it appears optional
# work around issues copying CVMFS xattr when copying to tmpdir
export TMPDIR=\$(mktemp -d -p .)
.env/bin/python -m ipykernel install --user
rm -rf \$TMPDIR && unset TMPDIR
.env/bin/python -m pip install -q git+https://github.com/CoffeaTeam/[email protected]
.env/bin/python -m pip install --user --editable .
echo "done."
}
export JUPYTER_PATH=/srv/.jupyter
export JUPYTER_RUNTIME_DIR=/srv/.local/share/jupyter/runtime
export JUPYTER_DATA_DIR=/srv/.local/share/jupyter
export IPYTHONDIR=/srv/.ipython
[[ -d .env ]] || install_env
source .env/bin/activate
alias pip="python -m pip"
EOF
chmod u+x shell .bashrc
echo "Wrote shell and .bashrc to current directory. You can delete this file. Run ./shell to start the singularity shell"