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

Side by Side Diff: build/android/test_wrapper/logdog_wrapper.py

Issue 2163833003: Logdog for logcats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update json files to include links Created 4 years, 4 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2016 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """Wrapper for adding logdog streaming support to swarming tasks."""
7
8 import argparse
9 import logging
10 import os
11 import subprocess
12 import sys
13 import urllib
14
15
16 def CommandParser():
17 # Parses the command line arguments being passed in
18 parser = argparse.ArgumentParser()
19 parser.add_argument('--logdog-bin-cmd', required=True,
20 help='Command for running logdog butler binary')
21 parser.add_argument('--project', required=True,
22 help='Name of logdog project')
23 parser.add_argument('--logdog-server',
24 default='services-dot-luci-logdog.appspot.com',
25 help='URL of logdog server, https:// is assumed.')
26 parser.add_argument('--service-account-json', required=True,
27 help='Location of authentication json')
28 parser.add_argument('--prefix', required=True,
29 help='Prefix to be used for logdog stream')
30 parser.add_argument('--source', required=True,
31 help='Location of file for logdog to stream')
32 parser.add_argument('--name', required=True,
33 help='Name to be used for logdog stream')
34 return parser
35
36
37 def CreateUrl(server, project, prefix, name):
38 stream_name = '%s/%s/+/%s' % (project, prefix, name)
39 return 'https://%s/v/?s=%s' % (server, urllib.quote_plus(stream_name))
40
41
42 def main():
43 parser = CommandParser()
44 args, test_cmd = parser.parse_known_args(sys.argv[1:])
45 logging.basicConfig(level=logging.INFO)
46 if not test_cmd:
47 parser.error('Must specify command to run after the logdog flags')
48 result = subprocess.call(test_cmd)
49 if '${SWARMING_TASK_ID}' in args.prefix:
50 args.prefix = args.prefix.replace('${SWARMING_TASK_ID}',
51 os.environ.get('SWARMING_TASK_ID'))
52 url = CreateUrl('luci-logdog.appspot.com', args.project, args.prefix,
53 args.name)
54 logdog_cmd = [args.logdog_bin_cmd, '-project', args.project,
55 '-output', 'logdog,host=%s' % args.logdog_server,
56 '-prefix', args.prefix,
57 '-service-account-json', args.service_account_json,
58 'stream', '-source', args.source,
59 '-stream', '-name=%s' % args.name]
60 subprocess.call(logdog_cmd)
61 logging.info('Logcats are located at: %s', url)
62 return result
63
64
65 if __name__ == '__main__':
66 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/pylib/local/device/local_device_environment.py ('k') | testing/buildbot/chromium.android.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698