| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 """A class to keep track of devices across builds and report state.""" | 7 """A class to keep track of devices across builds and report state.""" |
| 8 import logging | 8 import logging |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 if failed_restart: | 250 if failed_restart: |
| 251 return 1 | 251 return 1 |
| 252 | 252 |
| 253 return 0 | 253 return 0 |
| 254 | 254 |
| 255 | 255 |
| 256 def KillAllAdb(): | 256 def KillAllAdb(): |
| 257 def GetAllAdb(): | 257 def GetAllAdb(): |
| 258 for p in psutil.process_iter(): | 258 for p in psutil.process_iter(): |
| 259 if 'adb' in p.name or 'adb' in ' '.join(p.cmdline): | 259 if 'adb' in p.name: |
| 260 yield p | 260 yield p |
| 261 | 261 |
| 262 for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]: | 262 for sig in [signal.SIGTERM, signal.SIGQUIT, signal.SIGKILL]: |
| 263 for p in GetAllAdb(): | 263 for p in GetAllAdb(): |
| 264 try: | 264 try: |
| 265 print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name, | 265 print 'kill %d %d (%s [%s])' % (sig, p.pid, p.name, |
| 266 ' '.join(p.cmdline)) | 266 ' '.join(p.cmdline)) |
| 267 p.send_signal(sig) | 267 p.send_signal(sig) |
| 268 except psutil.error.NoSuchProcess: | 268 except psutil.error.NoSuchProcess: |
| 269 pass | 269 pass |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 # devices with critically low battery or install speed. Remove those devices | 350 # devices with critically low battery or install speed. Remove those devices |
| 351 # from testing, allowing build to continue with good devices. | 351 # from testing, allowing build to continue with good devices. |
| 352 return 1 | 352 return 1 |
| 353 | 353 |
| 354 if not devices: | 354 if not devices: |
| 355 return 1 | 355 return 1 |
| 356 | 356 |
| 357 | 357 |
| 358 if __name__ == '__main__': | 358 if __name__ == '__main__': |
| 359 sys.exit(main()) | 359 sys.exit(main()) |
| OLD | NEW |