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

Side by Side Diff: build/android/buildbot/bb_device_status_check.py

Issue 348623007: Only send email notification when device_status_check failed on buildbot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | 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
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 try: 134 try:
135 last_missing_devices = device_list.GetPersistentDeviceList( 135 last_missing_devices = device_list.GetPersistentDeviceList(
136 last_missing_devices_path) 136 last_missing_devices_path)
137 except IOError: 137 except IOError:
138 last_missing_devices = [] 138 last_missing_devices = []
139 139
140 missing_devs = list(set(last_devices) - set(adb_online_devs)) 140 missing_devs = list(set(last_devices) - set(adb_online_devs))
141 new_missing_devs = list(set(missing_devs) - set(last_missing_devices)) 141 new_missing_devs = list(set(missing_devs) - set(last_missing_devices))
142 142
143 if new_missing_devs: 143 if new_missing_devs and os.environ.get('BUILDBOT_SLAVENAME'):
144 logging.info('new_missing_devs %s' % new_missing_devs) 144 logging.info('new_missing_devs %s' % new_missing_devs)
145 devices_missing_msg = '%d devices not detected.' % len(missing_devs) 145 devices_missing_msg = '%d devices not detected.' % len(missing_devs)
146 bb_annotations.PrintSummaryText(devices_missing_msg) 146 bb_annotations.PrintSummaryText(devices_missing_msg)
147 147
148 from_address = 'chrome-bot@chromium.org' 148 from_address = 'chrome-bot@chromium.org'
149 to_addresses = ['zty@chromium.org'] 149 to_addresses = ['zty@chromium.org']
150 subject = 'Devices offline on %s' % os.environ.get('BUILDBOT_SLAVENAME') 150 subject = 'Devices offline on %s, %s, %s' % (
151 os.environ.get('BUILDBOT_SLAVENAME'),
152 os.environ.get('BUILDBOT_BUILDERNAME'),
153 os.environ.get('BUILDBOT_BUILDNUMBER'))
151 msg = ('Please reboot the following devices:\n%s' % 154 msg = ('Please reboot the following devices:\n%s' %
152 '\n'.join(map(str,new_missing_devs))) 155 '\n'.join(map(str,new_missing_devs)))
153 SendEmail(from_address, to_addresses, subject, msg) 156 SendEmail(from_address, to_addresses, subject, msg)
154 157
155 all_known_devices = list(set(adb_online_devs) | set(last_devices)) 158 all_known_devices = list(set(adb_online_devs) | set(last_devices))
156 device_list.WritePersistentDeviceList(last_devices_path, all_known_devices) 159 device_list.WritePersistentDeviceList(last_devices_path, all_known_devices)
157 device_list.WritePersistentDeviceList(last_missing_devices_path, missing_devs) 160 device_list.WritePersistentDeviceList(last_missing_devices_path, missing_devs)
158 161
159 if not all_known_devices: 162 if not all_known_devices:
160 # This can happen if for some reason the .last_devices file is not 163 # This can happen if for some reason the .last_devices file is not
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 # devices with critically low battery. Remove those devices from testing, 364 # devices with critically low battery. Remove those devices from testing,
362 # allowing build to continue with good devices. 365 # allowing build to continue with good devices.
363 return 2 366 return 2
364 367
365 if not devices: 368 if not devices:
366 return 1 369 return 1
367 370
368 371
369 if __name__ == '__main__': 372 if __name__ == '__main__':
370 sys.exit(main()) 373 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698