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

Side by Side Diff: build/android/bb_run_sharded_steps.py

Issue 18907002: Reland r210268: "Improve forwarder2 setup/tear down in telemetry." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Helper script to shard build bot steps and save results to disk. 7 """Helper script to shard build bot steps and save results to disk.
8 8
9 Our buildbot infrastructure requires each slave to run steps serially. 9 Our buildbot infrastructure requires each slave to run steps serially.
10 This is sub-optimal for android, where these steps can run independently on 10 This is sub-optimal for android, where these steps can run independently on
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 import pexpect 51 import pexpect
52 import pickle 52 import pickle
53 import os 53 import os
54 import signal 54 import signal
55 import shutil 55 import shutil
56 import sys 56 import sys
57 57
58 from pylib import android_commands 58 from pylib import android_commands
59 from pylib import cmd_helper 59 from pylib import cmd_helper
60 from pylib import constants 60 from pylib import constants
61 from pylib import forwarder
61 from pylib import ports 62 from pylib import ports
62 63
63 64
64 _OUTPUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out', 'step_results') 65 _OUTPUT_DIR = os.path.join(constants.DIR_SOURCE_ROOT, 'out', 'step_results')
65 66
66 67
67 def _SaveResult(result): 68 def _SaveResult(result):
68 with file(os.path.join(_OUTPUT_DIR, result['name']), 'w') as f: 69 with file(os.path.join(_OUTPUT_DIR, result['name']), 'w') as f:
69 f.write(pickle.dumps(result)) 70 f.write(pickle.dumps(result))
70 71
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 with file(steps, 'r') as f: 158 with file(steps, 'r') as f:
158 steps = json.load(f) 159 steps = json.load(f)
159 ret = 0 160 ret = 0
160 for step_name in steps.keys(): 161 for step_name in steps.keys():
161 ret |= _PrintStepOutput(step_name) 162 ret |= _PrintStepOutput(step_name)
162 return ret 163 return ret
163 164
164 165
165 def _KillPendingServers(): 166 def _KillPendingServers():
166 for retry in range(5): 167 for retry in range(5):
168 forwarder.Forwarder.KillHost()
167 for server in ['lighttpd', 'web-page-replay']: 169 for server in ['lighttpd', 'web-page-replay']:
168 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server]) 170 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server])
169 pids = [pid.strip() for pid in pids.split('\n') if pid.strip()] 171 pids = [pid.strip() for pid in pids.split('\n') if pid.strip()]
170 for pid in pids: 172 for pid in pids:
171 try: 173 try:
172 logging.warning('Killing %s %s', server, pid) 174 logging.warning('Killing %s %s', server, pid)
173 os.kill(int(pid), signal.SIGQUIT) 175 os.kill(int(pid), signal.SIGQUIT)
174 except Exception as e: 176 except Exception as e:
175 logging.warning('Failed killing %s %s %s', server, pid, e) 177 logging.warning('Failed killing %s %s %s', server, pid, e)
176 178
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 steps = json.load(f) 216 steps = json.load(f)
215 flaky_steps = [] 217 flaky_steps = []
216 if options.flaky_steps: 218 if options.flaky_steps:
217 with file(options.flaky_steps, 'r') as f: 219 with file(options.flaky_steps, 'r') as f:
218 flaky_steps = json.load(f) 220 flaky_steps = json.load(f)
219 return _RunShardedSteps(steps, flaky_steps, devices) 221 return _RunShardedSteps(steps, flaky_steps, devices)
220 222
221 223
222 if __name__ == '__main__': 224 if __name__ == '__main__':
223 sys.exit(main(sys.argv)) 225 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698