| 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 import argparse | 6 import argparse |
| 7 import copy | 7 import copy |
| 8 import json | 8 import json |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 except logdog_bootstrap.NotBootstrapped as e: | 198 except logdog_bootstrap.NotBootstrapped as e: |
| 199 LOGGER.info('Not bootstrapped: %s', e.message) | 199 LOGGER.info('Not bootstrapped: %s', e.message) |
| 200 except logdog_bootstrap.BootstrapError as e: | 200 except logdog_bootstrap.BootstrapError as e: |
| 201 LOGGER.warning('Could not bootstrap LogDog: %s', e.message) | 201 LOGGER.warning('Could not bootstrap LogDog: %s', e.message) |
| 202 except Exception as e: | 202 except Exception as e: |
| 203 LOGGER.exception('Exception while bootstrapping LogDog.') | 203 LOGGER.exception('Exception while bootstrapping LogDog.') |
| 204 finally: | 204 finally: |
| 205 if recipe_return_code is None: | 205 if recipe_return_code is None: |
| 206 LOGGER.info('Not using LogDog. Invoking `recipes.py` directly.') | 206 LOGGER.info('Not using LogDog. Invoking `recipes.py` directly.') |
| 207 recipe_return_code = _call(recipe_cmd) | 207 recipe_return_code = _call(recipe_cmd) |
| 208 | |
| 209 # Try to open recipe result JSON. Any failure will result in an exception | |
| 210 # and an infra failure. | |
| 211 with open(recipe_result_path) as f: | |
| 212 json.load(f) | |
| 213 return recipe_return_code | 208 return recipe_return_code |
| 214 | 209 |
| 215 | 210 |
| 216 def shell_main(argv): | 211 def shell_main(argv): |
| 217 logging.basicConfig( | 212 logging.basicConfig( |
| 218 level=(logging.DEBUG if '--verbose' in argv else logging.INFO)) | 213 level=(logging.DEBUG if '--verbose' in argv else logging.INFO)) |
| 219 | 214 |
| 220 if update_scripts.update_scripts(): | 215 if update_scripts.update_scripts(): |
| 221 # Re-execute with the updated remote_run.py. | 216 # Re-execute with the updated remote_run.py. |
| 222 return _call([sys.executable] + argv) | 217 return _call([sys.executable] + argv) |
| 223 | 218 |
| 224 stream = annotator.StructuredAnnotationStream() | 219 stream = annotator.StructuredAnnotationStream() |
| 225 with stream.step('remote_run_result'): | 220 with stream.step('remote_run_result'): |
| 226 return main(argv) | 221 return main(argv) |
| 227 | 222 |
| 228 | 223 |
| 229 if __name__ == '__main__': | 224 if __name__ == '__main__': |
| 230 sys.exit(shell_main(sys.argv)) | 225 sys.exit(shell_main(sys.argv)) |
| OLD | NEW |