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

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

Issue 11013024: Ignore device status check emailing exceptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use 'as' instead of ',' Created 8 years, 2 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 | 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 (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 """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 8
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 # Only send email if the first time a particular device goes offline 109 # Only send email if the first time a particular device goes offline
110 last_missing = ReadDeviceList('.last_missing') 110 last_missing = ReadDeviceList('.last_missing')
111 new_missing_devs = set(missing_devs) - set(last_missing) 111 new_missing_devs = set(missing_devs) - set(last_missing)
112 112
113 if new_missing_devs: 113 if new_missing_devs:
114 msg_body = '\r\n'.join( 114 msg_body = '\r\n'.join(
115 ['From: %s' % from_address, 115 ['From: %s' % from_address,
116 'To: %s' % to_address, 116 'To: %s' % to_address,
117 'Subject: %s' % subject, 117 'Subject: %s' % subject,
118 '', body]) 118 '', body])
119 server = smtplib.SMTP('localhost') 119 try:
120 server.sendmail(from_address, [to_address], msg_body) 120 server = smtplib.SMTP('localhost')
121 server.quit() 121 server.sendmail(from_address, [to_address], msg_body)
122 server.quit()
123 except Exception as e:
124 print 'Failed to send alert email. Error: %s' % e
122 else: 125 else:
123 new_devs = set(adb_online_devs) - set(last_devices) 126 new_devs = set(adb_online_devs) - set(last_devices)
124 if new_devs and os.path.exists(last_devices_path): 127 if new_devs and os.path.exists(last_devices_path):
125 buildbot_report.PrintWarning() 128 buildbot_report.PrintWarning()
126 buildbot_report.PrintSummaryText( 129 buildbot_report.PrintSummaryText(
127 '%d new devices detected' % len(new_devs)) 130 '%d new devices detected' % len(new_devs))
128 print ('New devices detected %s. And now back to your ' 131 print ('New devices detected %s. And now back to your '
129 'regularly scheduled program.' % list(new_devs)) 132 'regularly scheduled program.' % list(new_devs))
130 WriteDeviceList('.last_devices', (adb_online_devs + last_devices)) 133 WriteDeviceList('.last_devices', (adb_online_devs + last_devices))
131 WriteDeviceList('.last_missing', missing_devs) 134 WriteDeviceList('.last_missing', missing_devs)
(...skipping 18 matching lines...) Expand all
150 unique_types = list(set(types)) 153 unique_types = list(set(types))
151 unique_builds = list(set(builds)) 154 unique_builds = list(set(builds))
152 155
153 buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s' 156 buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s'
154 % (len(devices), unique_types, unique_builds)) 157 % (len(devices), unique_types, unique_builds))
155 print '\n'.join(reports) 158 print '\n'.join(reports)
156 CheckForMissingDevices(options, devices) 159 CheckForMissingDevices(options, devices)
157 160
158 if __name__ == '__main__': 161 if __name__ == '__main__':
159 sys.exit(main()) 162 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