mirror of
https://github.com/weaveworks/scope.git
synced 2026-09-06 10:17:19 +00:00
28c6aa0 Make prefix on runner schedule optional.452f2b7Merge pull request #8 from weaveworks/7-gzip4be5541Add gather_coverage.sh script.e22c576Compress cached images.f250a3bAdd sched CLI and update readme.6b3c735Add scheduler from weave git-subtree-dir: tools git-subtree-split: 28c6aa063c1b171c3ba42d958ad640d49f8c39f2
39 lines
1.0 KiB
Python
Executable File
39 lines
1.0 KiB
Python
Executable File
#!/usr/bin/python
|
|
import sys, string, json, urllib
|
|
import requests
|
|
|
|
BASE_URL="http://positive-cocoa-90213.appspot.com"
|
|
|
|
def test_time(test_name, runtime):
|
|
r = requests.post(BASE_URL + "/record/%s/%f" % (urllib.quote(test_name, safe=""), 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/%s/%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(sys.argv[2], int(sys.argv[3]), int(sys.argv[4]))
|
|
else:
|
|
usage()
|
|
|
|
if __name__ == '__main__':
|
|
main()
|