-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy-tasks.sh
executable file
·55 lines (52 loc) · 1.28 KB
/
deploy-tasks.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
#!/usr/bin/env bash
NATIVE_APP_NAME="/gpu-test"
NATIVE_CONFIG=$(cat << EOF
{
"id": "${NATIVE_APP_NAME}",
"cmd": "while [ true ]; do /usr/local/nvidia/bin/nvidia-smi; sleep 60; done",
"cpus": 0.1,
"mem": 128.0,
"gpus": 1,
"instances": 1,
"env": {
"LD_LIBRARY_PATH": "/usr/local/nvidia/lib64:/usr/local/nvidia/lib"
}
}
EOF
)
DOCKER_APP_NAME="/gpu-test-docker"
DOCKER_CONFIG=$(cat << EOF
{
"id": "${DOCKER_APP_NAME}",
"cmd": "while [ true ]; do nvidia-smi; sleep 60; done",
"cpus": 0.1,
"mem": 128.0,
"gpus": 1,
"instances": 1,
"container": {
"type": "MESOS",
"docker": {
"image": "nvidia/cuda"
}
}
}
EOF
)
if [ "$1" = "--remove" ]; then
echo "Deleting ${NATIVE_APP_NAME}"
curl -X DELETE http://localhost:8080/v2/apps/gpu-test
echo ""
echo "Deleting ${DOCKER_APP_NAME}"
curl -X DELETE http://localhost:8080/v2/apps/gpu-test-docker
else
echo "Creating ${NATIVE_APP_NAME}"
curl -X POST http://localhost:8080/v2/apps \
-d @<(echo ${NATIVE_CONFIG}) \
-H "Content-type: application/json"
echo ""
echo "Creating ${DOCKER_APP_NAME}"
curl -X POST http://localhost:8080/v2/apps \
-d @<(echo ${DOCKER_CONFIG}) \
-H "Content-type: application/json"
fi
echo ""