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

Unified Diff: build/android/tombstones.py

Issue 2577463003: Enable writing to logdog for tombstones.py. (Closed)
Patch Set: moved the logdog logic to a new method Created 4 years 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/tombstones.py
diff --git a/build/android/tombstones.py b/build/android/tombstones.py
index cba1e5a9f511da27af7e1b8c43e1df046118e81a..85940ae1d59bdda14e3430c2c8cb494c4c57c708 100755
--- a/build/android/tombstones.py
+++ b/build/android/tombstones.py
@@ -26,6 +26,10 @@ from devil.android import device_utils
from devil.utils import run_tests_helper
from pylib import constants
+sys.path.insert(0, os.path.abspath(os.path.join(
+ constants.DIR_SOURCE_ROOT, 'tools', 'swarming_client')))
+from libs.logdog import bootstrap # pylint: disable=import-error
+
_TZ_UTC = {'TZ': 'UTC'}
@@ -246,6 +250,29 @@ def ResolveTombstones(device, resolve_all_tombstones, include_stack_symbols,
include_stack_symbols,
wipe_tombstones))
jbudorick 2016/12/14 17:17:19 nit: +1 blank line
+def LogdogTombstones(resolved_tombstones, stream_name):
+ """Save resolved tombstones to logdog and return the url.
+
+ Args:
+ stream_name: The name of the logdog stream that records tombstones.
+ resolved_tombstones: Resolved tombstones (output of ResolveTombstones).
+ """
jbudorick 2016/12/14 17:17:19 nit: Add a Returns: doc here.
BigBossZhiling 2016/12/14 17:41:27 Done.
+ try:
+ tombstones_url = ''
+ stream_client = bootstrap.ButlerBootstrap.probe().stream_client()
+ logdog_stream = stream_client.open_text(stream_name)
jbudorick 2016/12/14 17:17:19 Do this with a context manager: with stream_cli
BigBossZhiling 2016/12/14 17:41:27 Done.
+ for tombstones_line in resolved_tombstones:
+ logdog_stream.write(tombstones_line + '\n')
+ tombstones_url = logdog_stream.get_viewer_url(stream_name)
+ logdog_stream.close()
+ except bootstrap.NotBootstrappedError:
+ logging.exception('Error not bootstrapped. Failed to start logdog')
+ except (KeyError, ValueError) as e:
+ logging.exception('Error when creating stream_client/stream: %s.', e)
+ except Exception as e: # pylint: disable=broad-except
+ logging.exception('Unknown Error: %s.', e)
+ return tombstones_url
+
jbudorick 2016/12/14 17:17:19 nit: +1 blank line
BigBossZhiling 2016/12/14 17:41:27 Done.
def main():
custom_handler = logging.StreamHandler(sys.stdout)
custom_handler.setFormatter(run_tests_helper.CustomFormatter())
« 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