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

Side by Side Diff: swarm_client/tools/harvest_buildbot.py

Issue 69143004: Delete swarm_client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Harvest data on the Try Server.
7
8 Please use sparingly. Large values for horizon will trash the Try Server memory.
9 """
10
11 import os
12 import optparse
13 import sys
14
15
16 def get_failed_builds(builder, horizon):
17 """Constructs the list of failed builds."""
18 builder.builds.cache()
19 return [
20 builder.builds[i] for i in xrange(-horizon, 0)
21 if not builder.builds[i].simplified_result
22 ]
23
24
25 def get_parent_build(build):
26 """Returns the parent build for a triggered build."""
27 parent_buildername = build.properties_as_dict['parent_buildername']
28 parent_builder = build.builders[parent_buildername]
29 return parent_builder.builds[build.properties_as_dict['parent_buildnumber']]
30
31
32 def parse(b, horizon):
33 print('Processing last %d entries' % horizon)
34 failed_builds = get_failed_builds(b.builders['swarm_triggered'], horizon)
35 rate = 100. * (1. - float(len(failed_builds)) / float(horizon))
36 print('Success: %3.1f%%' % rate)
37
38 NO_KEY = 'Warning: Unable to find any tests with the name'
39 HTTP_404 = 'threw HTTP Error 404: Not Found'
40 for build in failed_builds:
41 print('%s/%d on %s' % (build.builder.name, build.number, build.slave.name))
42 swarm_trigger_tests = build.steps['swarm_trigger_tests']
43 base_unittests = build.steps['base_unittests']
44 fail = ''
45 if swarm_trigger_tests.simplified_result:
46 fail = 'buildbot failed to pass arguments'
47 elif not swarm_trigger_tests.stdio:
48 fail = 'old swarm_trigger_step.py version'
49 else:
50 stdio = base_unittests.stdio
51 if NO_KEY in stdio:
52 fail = 'Failed to retrieve keys.'
53 elif HTTP_404 in stdio:
54 fail = 'Failed to retrieve keys with 404.'
55
56 if fail:
57 print(' Triggering failed: %s' % fail)
58 else:
59 # Print the first few lines.
60 lines = base_unittests.stdio.splitlines()[:15]
61 print('\n'.join(' ' + l for l in lines))
62 print(' %s %s %s %s' % (
63 build.properties_as_dict['use_swarm_client_revision'],
64 build.properties_as_dict['swarm_hashes'],
65 build.properties_as_dict.get('use_swarm_client_revision'),
66 build.properties_as_dict.get('testfilter')))
67
68
69 def main():
70 parser = optparse.OptionParser()
71 parser.add_option('-b', '--buildbot_json', help='path to buildbot_json.py')
72 parser.add_option(
73 '-u', '--url',
74 default='http://build.chromium.org/p/tryserver.chromium/',
75 help='server url, default: %default')
76 parser.add_option('-H', '--horizon', default=100, type='int')
77 options, args = parser.parse_args(None)
78 if args:
79 parser.error('Unsupported args: %s' % args)
80
81 if options.horizon < 10 or options.horizon > 2000:
82 parser.error('Use reasonable --horizon value')
83
84 if options.buildbot_json:
85 options.buildbot_json = os.path.abspath(options.buildbot_json)
86 if not os.path.isdir(options.buildbot_json):
87 parser.error('Pass a valid directory path to --buildbot_json')
88 sys.path.insert(0, options.buildbot_json)
89
90 try:
91 import buildbot_json # pylint: disable=F0401
92 except ImportError:
93 parser.error('Pass a directory path to buildbot_json.py with -b')
94
95 b = buildbot_json.Buildbot(options.url)
96 parse(b, options.horizon)
97 return 0
98
99
100 if __name__ == '__main__':
101 sys.exit(main())
OLDNEW
« no previous file with comments | « swarm_client/third_party/rietveld/upload.py ('k') | swarm_client/tools/isolateserver_load_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698