-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgridsearch.sh
executable file
·70 lines (53 loc) · 1.45 KB
/
gridsearch.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
#! /bin/bash
set -e
source VERSION
default () {
if ! [ "$(eval "echo \"\$$1\"")" ]; then
eval "export $1='$2'"
fi
}
default ARG_outdir ..
argparse() {
export ARGS=()
for _ARG in "$@"; do
if [ "${_ARG##--*}" == "" ]; then
_ARG="${_ARG#--}"
if [ "${_ARG%%*=*}" == "" ]; then
_ARGNAME="$(echo ${_ARG%=*} | tr - _)"
eval "export ARG_${_ARGNAME}"='"${_ARG#*=}"'
else
eval "export ARG_${_ARG}"='True'
fi
else
ARGS+=($_ARG)
fi
done
}
argparse "$@"
if [ "$ARG_help" ]; then
cat <<EOF
Usage:
gridsearch.sh OPTIONS
--outdir=${ARG_outdir}
--repository=${ARG_repository}
All options accepted by generategrid.py, e.g.:
--flows-min=2
--flows-max=40
--link-min=100
--link-max=10000
--link-resolution=20
--flow-bw-spread=0.5
--flow-bw-resolution=10
Any OPTIONS can also be given as environment variables with their
names prefixed with ARG_, e.g.
export ARG_outdir=${ARG_outdir}
EOF
exit 1
fi
ROOT="$(pwd)"
if [ "$(docker image ls -q "${ARG_repository}traffic-simulator:${VERSION}")" == "" ]; then
docker build --tag "${ARG_repository}traffic-simulator:${VERSION}" host
docker push "${ARG_repository}traffic-simulator:${VERSION}"
fi
./generategrid.py |
parallel --will-cite -S "$CLUSTER_NODES" --line-buffer "cd '${ROOT}'; ./gridsearchtask.sh '${ARG_repository}' '${ARG_outdir}' {}"