Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 for retry in range(5): | 168 for retry in range(5): |
| 169 for server in ['lighttpd', 'web-page-replay']: | 169 for server in ['lighttpd', 'web-page-replay']: |
| 170 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server]) | 170 pids = cmd_helper.GetCmdOutput(['pgrep', '-f', server]) |
| 171 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()] |
| 172 for pid in pids: | 172 for pid in pids: |
| 173 try: | 173 try: |
| 174 logging.warning('Killing %s %s', server, pid) | 174 logging.warning('Killing %s %s', server, pid) |
| 175 os.kill(int(pid), signal.SIGQUIT) | 175 os.kill(int(pid), signal.SIGQUIT) |
| 176 except Exception as e: | 176 except Exception as e: |
| 177 logging.warning('Failed killing %s %s %s', server, pid, e) | 177 logging.warning('Failed killing %s %s %s', server, pid, e) |
| 178 # Restart the adb server with full trace, and redirect stderr to stdout | 178 # Restart the adb server with taskset to set a single CPU affinity. |
| 179 # so the extra tracing won't confuse higher up layers. | |
| 180 os.environ['ADB_TRACE'] = 'all' | |
| 181 cmd_helper.RunCmd(['adb', 'kill-server']) | 179 cmd_helper.RunCmd(['adb', 'kill-server']) |
| 182 cmd_helper.RunCmd(['adb', 'start-server']) | 180 cmd_helper.RunCmd(['taskset', '-c', '1', 'adb', 'start-server']) |
|
frankf
2013/08/08 21:38:09
why not -c 0?
bulach
2013/08/09 09:15:47
my bad, I was confused by "man taskset": it says f
| |
| 183 cmd_helper.RunCmd(['adb', 'root']) | 181 cmd_helper.RunCmd(['adb', 'root']) |
| 184 i = 1 | 182 i = 1 |
| 185 while not android_commands.GetAttachedDevices(): | 183 while not android_commands.GetAttachedDevices(): |
| 186 time.sleep(i) | 184 time.sleep(i) |
| 187 i *= 2 | 185 i *= 2 |
| 188 if i > 10: | 186 if i > 10: |
| 189 break | 187 break |
| 190 | 188 |
| 191 | 189 |
| 192 def main(argv): | 190 def main(argv): |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 230 steps = json.load(f) | 228 steps = json.load(f) |
| 231 flaky_steps = [] | 229 flaky_steps = [] |
| 232 if options.flaky_steps: | 230 if options.flaky_steps: |
| 233 with file(options.flaky_steps, 'r') as f: | 231 with file(options.flaky_steps, 'r') as f: |
| 234 flaky_steps = json.load(f) | 232 flaky_steps = json.load(f) |
| 235 return _RunShardedSteps(steps, flaky_steps, devices) | 233 return _RunShardedSteps(steps, flaky_steps, devices) |
| 236 | 234 |
| 237 | 235 |
| 238 if __name__ == '__main__': | 236 if __name__ == '__main__': |
| 239 sys.exit(main(sys.argv)) | 237 sys.exit(main(sys.argv)) |
| OLD | NEW |