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

Side by Side Diff: recipe_engine/run.py

Issue 2845923002: [recipes.py] use argparse to set command automatically. (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « recipe_engine/remote.py ('k') | recipe_engine/test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The LUCI Authors. All rights reserved. 1 # Copyright 2017 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 """Entry point for fully-annotated builds. 5 """Entry point for fully-annotated builds.
6 6
7 This script is part of the effort to move all builds to annotator-based 7 This script is part of the effort to move all builds to annotator-based
8 systems. Any builder configured to use the AnnotatorFactory.BaseFactory() 8 systems. Any builder configured to use the AnnotatorFactory.BaseFactory()
9 found in scripts/master/factory/annotator_factory.py executes a single 9 found in scripts/master/factory/annotator_factory.py executes a single
10 AddAnnotatedScript step. That step (found in annotator_commands.py) calls 10 AddAnnotatedScript step. That step (found in annotator_commands.py) calls
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 help='The recipe to execute') 511 help='The recipe to execute')
512 run_p.add_argument( 512 run_p.add_argument(
513 'props', 513 'props',
514 nargs=argparse.REMAINDER, 514 nargs=argparse.REMAINDER,
515 type=parse_prop, 515 type=parse_prop,
516 help=( 516 help=(
517 'A list of property pairs; e.g. mastername=chromium.linux ' 517 'A list of property pairs; e.g. mastername=chromium.linux '
518 'issue=12345. The property value will be decoded as JSON, but if ' 518 'issue=12345. The property value will be decoded as JSON, but if '
519 'this decoding fails the value will be interpreted as a string.')) 519 'this decoding fails the value will be interpreted as a string.'))
520 520
521 run_p.set_defaults(command='run', properties={}, func=main) 521 run_p.set_defaults(properties={}, func=main)
522 522
523 523
524 def handle_recipe_return(recipe_result, result_filename, stream_engine, 524 def handle_recipe_return(recipe_result, result_filename, stream_engine,
525 engine_flags): 525 engine_flags):
526 if engine_flags and engine_flags.use_result_proto: 526 if engine_flags and engine_flags.use_result_proto:
527 return new_handle_recipe_return( 527 return new_handle_recipe_return(
528 recipe_result, result_filename, stream_engine) 528 recipe_result, result_filename, stream_engine)
529 529
530 if 'recipe_result' in recipe_result.result: 530 if 'recipe_result' in recipe_result.result:
531 result_string = json.dumps( 531 result_string = json.dumps(
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 ret = run_steps( 719 ret = run_steps(
720 properties, stream_engine, 720 properties, stream_engine,
721 step_runner.SubprocessStepRunner(stream_engine, engine_flags), 721 step_runner.SubprocessStepRunner(stream_engine, engine_flags),
722 universe_view, engine_flags=engine_flags, 722 universe_view, engine_flags=engine_flags,
723 emit_initial_properties=emit_initial_properties) 723 emit_initial_properties=emit_initial_properties)
724 finally: 724 finally:
725 os.chdir(old_cwd) 725 os.chdir(old_cwd)
726 726
727 return handle_recipe_return( 727 return handle_recipe_return(
728 ret, args.output_result_json, stream_engine, engine_flags) 728 ret, args.output_result_json, stream_engine, engine_flags)
OLDNEW
« no previous file with comments | « recipe_engine/remote.py ('k') | recipe_engine/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698