-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathitest.sh
More file actions
executable file
·139 lines (102 loc) · 4.5 KB
/
itest.sh
File metadata and controls
executable file
·139 lines (102 loc) · 4.5 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh -x
# Integration test script.
# This doesn't so much check for correct behaivor as non-crashing.
# Correct behavior can usually be determined by reading the log.
#
# Unit tests have better coverage of correct behavior, but don't
# exrecise the command line tool well, so there's this to test the
# command line tool.
#
# usage:
# mkdir tmp
# cd tmp
# ../itest.sh > TESTLOG 2>&1
# egrep -i 'traceback|error' TESTLOG
PORT=5932
HTTPPORT=5980
if `pip freeze | grep -c Jinja2`; then
# pip install Jinja2
python -m coordinate.run --port=${PORT} --httpd=:${HTTPPORT} --pid=icoordinated.pid &
else
python -m coordinate.run --port=${PORT} --pid=icoordinated.pid &
fi
cat >iconfig.yaml<<EOF
coordinate:
address: "127.0.0.1:${PORT}"
EOF
for i in addwork delete help prioritize retry status work_specs workers clear failed load quit rpc summary work_unit config flow pause resume run_one work_spec work_units; do
python -m coordinate.coordinatec -c iconfig.yaml help ${i}
if $?; then echo "ERROR getting help ${i}"; fi
done
cat >iworkspec.yaml<<EOF
name: toyws1
min_gb: 0.1
module: coordinate.tests.test_job_client
run_function: run_function
EOF
python -m coordinate.coordinatec -c iconfig.yaml load --work-spec=iworkspec.yaml --no-work
python -m coordinate.coordinatec -c iconfig.yaml work_specs
python -m coordinate.coordinatec -c iconfig.yaml work_spec --work-spec-name=toyws1 --json
python -m coordinate.coordinatec -c iconfig.yaml work_spec --work-spec-name=toyws1 --yaml
python -m coordinate.coordinatec -c iconfig.yaml summary
python -m coordinate.coordinatec -c iconfig.yaml addwork --work-spec-name=toyws1 -u - <<EOF
{"wu1":{}}
{"wu2":{}}
EOF
python -m coordinate.coordinatec -c iconfig.yaml summary
python -m coordinate.coordinatec -c iconfig.yaml work_unit --work-spec-name=toyws1 wu1 wu2
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=toyws1
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=toyws1
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=toyws1 --details
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=toyws1 --details -s available
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=toyws1 --details -s finished
python -m coordinate.coordinatec -c iconfig.yaml clear --work-spec-name=toyws1 -s finished
python -m coordinate.coordinatec -c iconfig.yaml status --work-spec-name=toyws1
python -m coordinate.coordinatec -c iconfig.yaml clear --work-spec-name=toyws1 -s available
python -m coordinate.coordinatec -c iconfig.yaml status --work-spec-name=toyws1
cat > iflow.yaml<<EOF
flows:
first:
min_gb: 0.1
module: coordinate.tests.test_job_flow
run_function: first_function
then: second
second:
min_gb: 0.1
module: coordinate.tests.test_job_flow
run_function: second_function
run_params: ["foo"]
EOF
python -m coordinate.coordinatec -c iconfig.yaml flow iflow.yaml
python -m coordinate.coordinatec -c iconfig.yaml summary
python -m coordinate.coordinatec -c iconfig.yaml addwork --work-spec-name=first -u - <<EOF
{"aa":{}}
{"bb":{}}
{"cc":{}}
{"dd":{}}
{"ee":{}}
EOF
python -m coordinate.coordinatec -c iconfig.yaml prioritize first cc
# doesn't show anything about priority, maybe it should:
#python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=first --details
# runs cc
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml work_units --work-spec-name=first --details
python -m coordinate.coordinatec -c iconfig.yaml pause first
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml resume first
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml pause second
python -m coordinate.coordinatec -c iconfig.yaml run_one
python -m coordinate.coordinatec -c iconfig.yaml resume second
python -m coordinate.coordinatec -c iconfig.yaml config
# nop
python -m coordinate.coordinatec -c iconfig.yaml quit
# won't show any because we don't have any persistent workers, just run_one
python -m coordinate.coordinatec -c iconfig.yaml workers
python -m coordinate.coordinatec -c iconfig.yaml delete -y
# TODO: things not exercised: retry, rpc
kill -9 `cat icoordinated.pid`