-
Notifications
You must be signed in to change notification settings - Fork 3
/
startup.sh
executable file
·58 lines (46 loc) · 1.79 KB
/
startup.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
52
53
54
55
56
57
58
#!/bin/bash
# The IPython image starts as privileged user.
# The parent Galaxy server is mounting data into /import with the same
# permissions as the Galaxy server is running on.
# In case of 1450 as UID and GID we are fine, because our preconfigured ipython
# user owns this UID/GID.
# (1450 is the user id the Galaxy-Docker Image is using)
# If /import is not owned by 1450 we need to create a new user with the same
# UID/GID as /import and make everything accessible to this new user.
#
# In the end the IPython Server is started as non-privileged user. Either
# with the UID 1450 (preconfigured jupyter user) or a newly created 'galaxy' user
# with the same UID/GID as /import.
export PATH=/home/$NB_USER/.local/bin:$PATH
# Check if the node has GPU. Activate CPU or GPU version of tensorflow
if nvidia-smi 2> /dev/null; then
echo An NVDIA GPU was detected.
ln -s $PYTHON_LIB_PATH/tensorflow-GPU-cached $PYTHON_LIB_PATH/tensorflow
else
echo No compatible GPU present.
ln -s $PYTHON_LIB_PATH/tensorflow-CPU-cached $PYTHON_LIB_PATH/tensorflow
fi
python /get_notebook.py
if [ ! -f /import/home_page.ipynb ]; then
cp /home/$NB_USER/*.ipynb /import/
chown $NB_USER /import/*.ipynb
fi
mkdir /import/elyra/
cp /home/$NB_USER/elyra/*.* /import/elyra/
mkdir /import/data/
cp /home/$NB_USER/data/*.tsv /import/data/
mkdir /import/notebooks/
cp /home/$NB_USER/notebooks/*.ipynb /import/notebooks/
mkdir /import/usecases/
cp /home/$NB_USER/usecases/*.ipynb /import/usecases/
chown $NB_USER /import/elyra/*.*
chown $NB_USER /import/data/*.tsv
jupyter trust /import/*.ipynb
jupyter trust /import/elyra/*.ipynb
jupyter trust /import/notebooks/*.ipynb
jupyter trust /import/usecases/*.ipynb
if [ "$NB_USER" == "root" ]; then
jupyter lab --no-browser --allow-root
else
jupyter lab --no-browser
fi