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

Unified Diff: build/android/device_status_check.py

Issue 11021004: Make device_status_check.py email clank-infra if devices go offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/device_status_check.py
diff --git a/build/android/device_status_check.py b/build/android/device_status_check.py
index b3447cae0f42bbb3e6bd1521baf13c48e5b7b8e8..0aa29c0b58faedac96f9125388e76c2b18621062 100755
--- a/build/android/device_status_check.py
+++ b/build/android/device_status_check.py
@@ -8,6 +8,8 @@
import optparse
import os
+import smtplib
+import string
import sys
from pylib import buildbot_report
@@ -70,15 +72,38 @@ def CheckForMissingDevices(options, adb_online_devs):
missing_devs = list(set(last_devices) - set(adb_online_devs))
if missing_devs:
+ from_address = 'buildbot@chromium.org'
+ to_address = 'clank-infrastructure-team@google.com'
Isaac (away) 2012/09/29 03:17:04 Suggest we add a keyword to this to make it easier
Isaac (away) 2012/09/29 03:33:08 You can ignore this earlier comment. But we can't
navabi1 2012/10/01 21:52:15 Done.
+ script_path_list = os.getcwd().split('/')
+ # Assumes name of bot is after .../build/slave/<BOT NAME>/...
Isaac (away) 2012/09/29 03:17:04 I think cleaner to either use environment variable
navabi1 2012/10/01 21:52:15 Done.
+ slave_index = script_path_list.index('slave')
+ bot_name = script_path_list[slave_index + 1]
+ subject = 'Device not detected on %s' % bot_name
Isaac (away) 2012/09/29 03:17:04 Several of the testers have the same name (they're
navabi1 2012/10/01 21:52:15 Rather than pass FACTORY_PROPERTIES, I'll use the
Isaac (away) 2012/10/01 22:35:45 sg
+
buildbot_report.PrintWarning()
- buildbot_report.PrintSummaryText(
- '%d devices not detected.' % len(missing_devs))
- print 'Current online devices: %s' % adb_online_devs
- print '%s are no longer visible. Were they removed?\n' % missing_devs
- print 'SHERIFF: See go/chrome_device_monitor'
- print 'Cache file: %s\n\n' % last_devices_path
- print 'adb devices'
- print GetCmdOutput(['adb', 'devices'])
+ devices_missing_msg = '%d devices not detected.' % len(missing_devs)
+ buildbot_report.PrintSummaryText(devices_missing_msg)
+
+ body = string.join((
Isaac (away) 2012/09/29 03:17:04 nit: python will implicitly join strings that are
navabi1 2012/10/01 21:52:15 I prefer to leave it like this. While it is clean
Isaac (away) 2012/10/01 22:35:45 sg, was confused by the string.join
+ 'Current online devices: %s' % adb_online_devs,
+ '%s are no longer visible. Were they removed?\n' % missing_devs,
+ 'SHERIFF: See go/clank/engineering/buildbots/troubleshooting',
+ 'Cache file: %s\n\n' % last_devices_path,
+ 'adb devices', GetCmdOutput(['adb', 'devices'])), "\r\n")
+
+ msg_body = string.join((
+ "From: %s" % from_address,
+ "To: %s" % to_address,
+ "Subject: %s" % subject,
+ "",
+ body), "\r\n")
+
+ print body
+
+ # Send email from to clank infra
+ server = smtplib.SMTP('localhost')
+ server.sendmail(from_address, [to_address], msg_body)
+ server.quit()
else:
new_devs = set(adb_online_devs) - set(last_devices)
if new_devs and os.path.exists(last_devices_path):
« 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