-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_tensorflow.sh
executable file
·74 lines (61 loc) · 2.23 KB
/
start_tensorflow.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
#=================================================================
# date: 2021-08-20
# title: start_tensorflow
# author: QRS
#=================================================================
export LANG="en_US.utf8"
CUR_FIL=${BASH_SOURCE[0]}
TOP_DIR=`cd $(dirname $CUR_FIL); pwd`
DST_DIR='/hzcsk12'
VENDOR=hzcsai_com
K12NB_PROJECT=k12nb_tf
K12NB_PORT=8778
K12NB_WWW_PORT=9091
K12PYR_PROJECT=k12pyr
K12PYR_PORT=8178
MINIO_SERVER_URL='s3-internal.didiyunapi.com'
MINIO_ACCESS_KEY='AKDD002E38WR1J7RMPTGRIGNVCVINY'
MINIO_SECRET_KEY='ASDDXYWs45ov7MNJbj5Wc2PM9gC0FSqCIkiyQkVC'
__start_notebook()
{
PROJECT=$1
PORT=$2
REPOSITORY=$VENDOR/$PROJECT
JNAME=k12nb_tf
check_exist=`docker container ls --filter name=${JNAME} --filter status=running -q`
echo "docker container ls --filter name=${JNAME} --filter status=running -q"
if [[ x$check_exist == x ]]
then
SOURCE_NOTE_DIR=$TOP_DIR
TARGET_NOTE_DIR=$DST_DIR/hzcsnote
if [[ $PROJECT == $K12NB_PROJECT ]]
then
xvfb_args="" # "xvfb-run -a -s \"-screen 0 1400x900x24\""
else
xvfb_args=""
fi
docker run -dit --runtime nvidia --name ${JNAME} --restart unless-stopped --shm-size 10g \
--volume $SOURCE_NOTE_DIR:$TARGET_NOTE_DIR \
--entrypoint /bin/bash ${@:3:$#} --network host --hostname ${JNAME} ${REPOSITORY} \
-c "umask 0000; $xvfb_args jupyter notebook --no-browser --notebook-dir=$TARGET_NOTE_DIR --allow-root --ip=0.0.0.0 --port=$PORT"
else
echo "$JNAME: already run!!!"
fi
}
__main()
{
__start_notebook $K12NB_PROJECT $K12NB_PORT \
--env PYTHONPATH=$DST_DIR/hzcsnote \
--env MINIO_SERVER_URL=$MINIO_SERVER_URL \
--env MINIO_ACCESS_KEY=$MINIO_ACCESS_KEY \
--env MINIO_SECRET_KEY=$MINIO_SECRET_KEY \
--volume /data:/data \
--volume /data/kaggle:/kaggle \
--volume /raceai:/raceai \
--volume $TOP_DIR/.jupyter_config/etc/netrc:/root/.netrc \
--volume $TOP_DIR/.jupyter_config/jupyter:/root/.jupyter \
--volume $TOP_DIR/.jupyter_config/local/share/jupyter:/root/.local/share/jupyter \
--volume /data/pretrained/cv:/root/.cache/torch/hub/checkpoints
}
__main $*