Add smarter scheduler to decide which tests to run on which shard on circle.

This commit is contained in:
Tom Wilkie authored and Tom Wilkie committed 2015-05-29 12:35:43 +00:00
1 parent 332a1bf58d
commit 0a945a04f3
5 files changed
+133 -11

No files matched your search

Executable
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/python
import sys, string, json
import requests
BASE_URL="http://positive-cocoa-90213.appspot.com"
def test_time(test_name, runtime):
r = requests.post(BASE_URL + "/record/%s/%f" % (test_name, runtime))
print r.text
assert r.status_code == 204
def test_sched(test_run, shard_count, shard_id):
tests = json.dumps({'tests': string.split(sys.stdin.read())})
r = requests.post(BASE_URL + "/schedule/%d/%d/%d" % (test_run, shard_count, shard_id), data=tests)
assert r.status_code == 200
result = r.json()
for test in sorted(result['tests']):
print test
def usage():
print "%s <cmd> <args..>" % sys.argv[0]
print " time <test name> <run time>"
print " sched <test run> <num shards> <shard id>"
def main():
if len(sys.argv) < 4:
usage()
sys.exit(1)
if sys.argv[1] == "time":
test_time(sys.argv[2], float(sys.argv[3]))
elif sys.argv[1] == "sched":
test_sched(int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4]))
else:
usage()
if __name__ == '__main__':
main()