-
Notifications
You must be signed in to change notification settings - Fork 92
/
run-fly
executable file
·58 lines (46 loc) · 1.47 KB
/
run-fly
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
#!/usr/bin/env bash
# refer to https://push-language.hampshire.edu/t/running-batch-experiments-with-hampshires-cluster/691 for documentation
set -o errexit
set -o errtrace
set -o nounset
set -o pipefail
#
n="$1"
fly_user="$2"
label="$3"
tag="$4"
number="$RANDOM"
# from http://stackoverflow.com/a/3104922/907060
function quote_args {
printf '"%s" ' "$@"; echo "";
}
# quote each arg so it is quoted in SSH
lein_command=$(quote_args "${@:5}")
homedir="/home/${fly_user}"
rundir="$homedir/runs/$label-$number"
repodir="$rundir/Clojush"
outputdir="$rundir/output"
ssh ${fly_user}@fly.hampshire.edu "mkdir -p $rundir"
rsync --exclude=out -v --progress \
--recursive \
--inplace \
--links \
--perms \
--times \
--delete \
--force \
--human-readable \
. "${fly_user}@fly.hampshire.edu:${repodir}"
ssh ${fly_user}@fly.hampshire.edu "mkdir -p $outputdir"
ssh ${fly_user}@fly.hampshire.edu /opt/pixar/tractor-blade-1.7.2/tractor-spool.py \
--engine=fly:8000 \
--svckey="${tag}" \
--title="$label-$number" \
--jobcwd="${repodir}" \
--priority=1 \
--range 1-${n} \
-c "bash -c 'env JAVA_CMD=/usr/java/latest/bin/java /share/apps/bin/lein run $lein_command :label $label > $outputdir/RANGE.out 2> $outputdir/RANGE.err'"
echo "Job ID: ${number}"
echo "Monitor status on http://fly.hampshire.edu:8000/tractor/tv/"
echo "Once the job has been started, you can monitor the outputs with:"
echo "ssh ${fly_user}@fly.hampshire.edu \"tail -F $outputdir/{1..$n}.{out,err}\""