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

Side by Side Diff: recipes.py

Issue 2245113002: Track step nesting in StreamEngine. (Closed) Base URL: https://github.com/luci/recipes-py@emit-initial-properties
Patch Set: Rebase, comments. Created 4 years, 3 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_modules/step/config.py ('k') | recipes/example/nested.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 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The LUCI Authors. All rights reserved. 2 # Copyright 2015 The LUCI Authors. All rights reserved.
3 # Use of this source code is governed under the Apache License, Version 2.0 3 # Use of this source code is governed under the Apache License, Version 2.0
4 # that can be found in the LICENSE file. 4 # that can be found in the LICENSE file.
5 5
6 """Tool to interact with recipe repositories. 6 """Tool to interact with recipe repositories.
7 7
8 This tool operates on the nearest ancestor directory containing an 8 This tool operates on the nearest ancestor directory containing an
9 infra/config/recipes.cfg. 9 infra/config/recipes.cfg.
10 """ 10 """
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 os.path.join(os.path.dirname(os.path.realpath(__file__)), 'workdir')) 147 os.path.join(os.path.dirname(os.path.realpath(__file__)), 'workdir'))
148 logging.info('Using %s as work directory' % workdir) 148 logging.info('Using %s as work directory' % workdir)
149 if not os.path.exists(workdir): 149 if not os.path.exists(workdir):
150 os.makedirs(workdir) 150 os.makedirs(workdir)
151 151
152 old_cwd = os.getcwd() 152 old_cwd = os.getcwd()
153 os.chdir(workdir) 153 os.chdir(workdir)
154 stream_engine = stream.ProductStreamEngine( 154 stream_engine = stream.ProductStreamEngine(
155 stream.StreamEngineInvariants(), 155 stream.StreamEngineInvariants(),
156 stream.AnnotatorStreamEngine( 156 stream.AnnotatorStreamEngine(
157 sys.stdout, emit_timestamps=(args.timestamps or 157 sys.stdout,
158 op_args.annotation_flags.emit_timestamp))) 158 emit_timestamps=(args.timestamps or
159 op_args.annotation_flags.emit_timestamp)))
159 with stream_engine: 160 with stream_engine:
160 # Emit initial properties if configured to do so. 161 # Emit initial properties if configured to do so.
161 if op_args.annotation_flags.emit_initial_properties: 162 if op_args.annotation_flags.emit_initial_properties:
162 with stream_engine.new_step_stream('Initial Properties') as s: 163 with stream_engine.new_step_stream('Initial Properties') as s:
163 for key in sorted(properties.iterkeys()): 164 for key in sorted(properties.iterkeys()):
164 s.set_build_property(key, json.dumps(properties[key], sort_keys=True)) 165 s.set_build_property(key, json.dumps(properties[key], sort_keys=True))
165 166
166 try: 167 try:
167 ret = recipe_run.run_steps( 168 ret = recipe_run.run_steps(
168 properties, stream_engine, 169 properties, stream_engine,
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 ret = main() 567 ret = main()
567 if not isinstance(ret, int): 568 if not isinstance(ret, int):
568 if ret is None: 569 if ret is None:
569 ret = 0 570 ret = 0
570 else: 571 else:
571 print >> sys.stderr, ret 572 print >> sys.stderr, ret
572 ret = 1 573 ret = 1
573 sys.stdout.flush() 574 sys.stdout.flush()
574 sys.stderr.flush() 575 sys.stderr.flush()
575 os._exit(ret) 576 os._exit(ret)
OLDNEW
« no previous file with comments | « recipe_modules/step/config.py ('k') | recipes/example/nested.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698