OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Wrapper for adding logdog streaming support to swarming tasks.""" | 6 """Wrapper for adding logdog streaming support to swarming tasks.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 args.prefix = args.prefix.replace('${SWARMING_TASK_ID}', | 65 args.prefix = args.prefix.replace('${SWARMING_TASK_ID}', |
66 os.environ.get('SWARMING_TASK_ID')) | 66 os.environ.get('SWARMING_TASK_ID')) |
67 url = CreateUrl('luci-logdog.appspot.com', args.project, args.prefix, | 67 url = CreateUrl('luci-logdog.appspot.com', args.project, args.prefix, |
68 args.name) | 68 args.name) |
69 logdog_cmd = [args.logdog_bin_cmd, '-project', args.project, | 69 logdog_cmd = [args.logdog_bin_cmd, '-project', args.project, |
70 '-output', 'logdog,host=%s' % args.logdog_server, | 70 '-output', 'logdog,host=%s' % args.logdog_server, |
71 '-prefix', args.prefix, | 71 '-prefix', args.prefix, |
72 '-service-account-json', args.service_account_json, | 72 '-service-account-json', args.service_account_json, |
73 'stream', '-source', args.source, | 73 'stream', '-source', args.source, |
74 '-stream', '-name=%s' % args.name] | 74 '-stream', '-name=%s' % args.name] |
75 if os.path.exists(args.logdog_bin_cmd): | 75 |
| 76 if not os.path.exists(args.logdog_bin_cmd): |
| 77 logging.error( |
| 78 'Logfog binary %s unavailable. Unable to upload logcats.', |
| 79 args.logdog_bin_cmd) |
| 80 elif not os.path.exists(args.source): |
| 81 logging.error( |
| 82 'Logcat sources not found at %s. Unable to upload logcats.', |
| 83 args.source) |
| 84 else: |
76 subprocess.call(logdog_cmd) | 85 subprocess.call(logdog_cmd) |
77 logging.info('Logcats are located at: %s', url) | 86 logging.info('Logcats are located at: %s', url) |
78 return result | 87 return result |
79 | 88 |
80 | 89 |
81 if __name__ == '__main__': | 90 if __name__ == '__main__': |
82 sys.exit(main()) | 91 sys.exit(main()) |
OLD | NEW |