-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.sh
executable file
·67 lines (58 loc) · 1.47 KB
/
run.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
#!/usr/bin/env bash
: ${HOSTNAME:="localhost"}
: ${LIBPROCESS_IP:="127.0.0.1"}
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD_DIR=${CURRENT_DIR}/build
BIN_DIR=${BUILD_DIR}/bin
if [ "$NUM_GPU_DEVICES" != "" ]; then
SET_GPU_RESOURCES="-e \"MESOS_RESOURCES=gpus:$NUM_GPU_DEVICES;\""
fi
docker_rm() {
if [ "$(docker ps --filter "name=$1" -a -q)" != "" ]; then
docker rm -f "$1"
fi
}
# Run nvidia-docker-plugin
sudo killall nvidia-docker-plugin > /dev/null 2>&1
sudo -b nohup ${BIN_DIR}/nvidia-docker-plugin > ${BUILD_DIR}/nvidia-docker.log 2>&1
# Run zookeeper
docker_rm zookeeper
docker run \
-d \
-p 2181:2181 \
--net="host" \
--name zookeeper \
zookeeper
# Run the Mesos master
docker_rm mesos-master
docker run \
-d \
-p 5050:5050 \
--net="host" \
-e "LIBPROCESS_IP=$LIBPROCESS_IP" \
--name mesos-master \
mesos-master
# Run the Mesos agent
docker_rm mesos-agent
${BIN_DIR}/nvidia-docker run \
-d \
-p 5051:5051 \
--net="host" \
-e "LIBPROCESS_IP=$LIBPROCESS_IP" \
$SET_GPU_RESOURCES \
-e "MESOS_CGROUPS_HIERARCHY=/sys/fs/cgroup/docker" \
-v /sys/fs/cgroup/docker \
--privileged \
--name mesos-agent \
mesos-agent
# Run Marathon
docker_rm marathon
docker run \
-d \
-p 8080:8080 \
-p 60035:60035 \
--net="host" \
-e "LIBPROCESS_IP=$LIBPROCESS_IP" \
-e "MARATHON_HOSTNAME=$HOSTNAME" \
--name marathon \
marathon --enable_features "gpu_resources"