OLD | NEW |
1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 from __future__ import print_function | 5 from __future__ import print_function |
6 | 6 |
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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 'Requires --output-json.')) | 286 'Requires --output-json.')) |
287 | 287 |
288 def postprocess_func(parser, args): | 288 def postprocess_func(parser, args): |
289 if args.no_fetch: | 289 if args.no_fetch: |
290 parser.error('autoroll with --no-fetch does not make sense.') | 290 parser.error('autoroll with --no-fetch does not make sense.') |
291 | 291 |
292 if args.verbose_json and not args.output_json: | 292 if args.verbose_json and not args.output_json: |
293 parser.error('--verbose-json passed without --output-json') | 293 parser.error('--verbose-json passed without --output-json') |
294 | 294 |
295 autoroll_p.set_defaults( | 295 autoroll_p.set_defaults( |
296 command='autoroll', func=main, postprocess_func=postprocess_func) | 296 func=main, postprocess_func=postprocess_func) |
297 | 297 |
298 | 298 |
299 def main(_package_deps, args): | 299 def main(_package_deps, args): |
300 config_file = args.package | 300 config_file = args.package |
301 repo_root = package.InfraRepoConfig().from_recipes_cfg(config_file.path) | 301 repo_root = package.InfraRepoConfig().from_recipes_cfg(config_file.path) |
302 | 302 |
303 package_pb = config_file.read() | 303 package_pb = config_file.read() |
304 | 304 |
305 context = package.PackageContext.from_package_pb( | 305 context = package.PackageContext.from_package_pb( |
306 repo_root, package_pb, allow_fetch=not args.no_fetch) | 306 repo_root, package_pb, allow_fetch=not args.no_fetch) |
(...skipping 12 matching lines...) Expand all Loading... |
319 # Restore initial state. Since we could be running simulation tests | 319 # Restore initial state. Since we could be running simulation tests |
320 # on other revisions, re-run them now as well. | 320 # on other revisions, re-run them now as well. |
321 write_spec_to_disk(context, repo_cfg_block, config_file, package_pb) | 321 write_spec_to_disk(context, repo_cfg_block, config_file, package_pb) |
322 run_simulation_test(repo_root, package_spec.recipes_path, ['train']) | 322 run_simulation_test(repo_root, package_spec.recipes_path, ['train']) |
323 | 323 |
324 if args.output_json: | 324 if args.output_json: |
325 with args.output_json: | 325 with args.output_json: |
326 json.dump(results, args.output_json, sort_keys=True, indent=2) | 326 json.dump(results, args.output_json, sort_keys=True, indent=2) |
327 | 327 |
328 return 0 | 328 return 0 |
OLD | NEW |