-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
51 lines (42 loc) · 1.75 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
45
46
47
48
49
50
51
#!/usr/bin/env bash
cat <<EOF > shell
#!/usr/bin/env bash
if [ "\$1" == "" ]; then
export COFFEA_IMAGE=coffeateam/coffea-dask-cc7:latest
else
export COFFEA_IMAGE=\$1
fi
grep -v '^include' /etc/condor/config.d/00hep_wisc.config > .condor_config
EXTERNAL_BIND=\${PWD} singularity exec -B \${PWD}:/srv -B /etc/condor -B /scratch -B /afs --pwd /srv \\
/cvmfs/unpacked.cern.ch/registry.hub.docker.com/\${COFFEA_IMAGE} \\
/bin/bash --rcfile /srv/.bashrc
EOF
cat <<EOF > .bashrc
LPCJQ_VERSION="0.2.10"
install_env() {
set -e
echo "Installing shallow virtual environment in \$PWD/.env..."
python -m venv --without-pip --system-site-packages .env
echo "Virtual environment created..."
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 .)
echo "Created Temporary directory..."
.env/bin/python -m ipykernel install --user
rm -rf \$TMPDIR && unset TMPDIR
echo "HTCondor workaround executed successfully..."
.env/bin/python -m pip install -q git+https://github.com/CoffeaTeam/lpcjobqueue.git@v\${LPCJQ_VERSION}
echo "LPCJobqueue installed..."
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"
pip show lpcjobqueue 2>/dev/null | grep -q "Version: \${LPCJQ_VERSION}" || pip install -q git+https://github.com/CoffeaTeam/lpcjobqueue.git@v\${LPCJQ_VERSION}
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"