Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: trigger_ct_lua

Issue 1214843002: Add script for triggering Cluster Telemetry jobs using local scripts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« tools/lua/ngrams.lua ('K') | « tools/lua/ngrams.lua ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3
4 """ Trigger a Cluster Telemetry job with the given Lua script. """
5
6
7 import argparse
8 import getpass
9 import httplib2
10 import subprocess
11 import urllib
12
13
14 CT_URL = 'https://skia-tree-status.appspot.com/skia-telemetry/add_lua_task'
15 POST_DATA = ('username=%s'
16 '&password=%s'
17 '&description=%s'
18 '&lua_script=%s'
19 '&pagesets_type_and_chromium_build='
20 '10k-1f255cfb7df10bc635d2495f71e6d0e6975b9e3a-'
21 'c94a028ff836f8f0af41ec33ceb1f4bc140841bf')
borenet 2015/06/26 19:58:45 I just hard-coded this for now. Ideally the defaul
rmistry 2015/06/26 20:16:01 Yes it should be simple to fix this on the fronten
22
23
24 def trigger_ct_run(user, password, description, script, aggregator=None):
25 """Trigger a Cluster Telemetry run of the given script."""
26 with open(script) as f:
27 script_contents = f.read()
28
29 body = POST_DATA % (user, password, description, script_contents)
30
31 if aggregator:
32 with open(aggregator) as f:
33 body += '&lua_aggregator=%s' % f.read()
34
35 resp, content = httplib2.Http('.cache').request(CT_URL, 'POST', body=body)
36 if resp['status'] != '200':
37 raise Exception(
38 'Failed to trigger Cluster Telemetry job: (%s): %s' % (
39 resp['status'], content))
40
41
42 def parse_args():
43 """Parse command-line flags and obtain any additional information."""
44 parser = argparse.ArgumentParser(
45 description='Trigger a Cluster Telemetry job with the given Lua script.')
46 parser.add_argument('script', help='Lua script to run')
47 parser.add_argument('--aggregator', help='Aggregator script')
48 parser.add_argument('--description', help='Description of the job.')
49 parser.add_argument('--email', help='Email address to send results')
50 args = parser.parse_args()
51
52 user = args.email
53 if not user:
54 user = subprocess.check_output(['git', 'config', 'user.email']).rstrip()
55
56 password = getpass.getpass(
57 'Enter the skia_status_password '
58 '(on https://valentine.corp.google.com/): ')
borenet 2015/06/26 19:58:45 This kills the automation. An alternative is to a
rmistry 2015/06/26 20:16:01 Yes all of this sounds good :)
59
60 return user, password, args.description, args.script, args.aggregator
61
62
63 def main():
64 user, password, description, script, aggregator = parse_args()
65 trigger_ct_run(user, password, description, script, aggregator)
66 print ('Successfully triggered Cluster Telemetry job. View the queue at '
67 'https://skia-tree-status.appspot.com/skia-telemetry/pending_tasks')
68
69
70 if __name__ == '__main__':
71 main()
OLDNEW
« tools/lua/ngrams.lua ('K') | « tools/lua/ngrams.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698