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

Side by Side Diff: recipe_engine/run.py

Issue 2934583003: [step] Remove config indirection. (Closed)
Patch Set: cleanup Created 3 years, 6 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
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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 step_result=None, 267 step_result=None,
268 open_step=open_step)) 268 open_step=open_step))
269 269
270 step_result = open_step.run() 270 step_result = open_step.run()
271 self._step_stack[-1] = ( 271 self._step_stack[-1] = (
272 self._step_stack[-1]._replace(step_result=step_result)) 272 self._step_stack[-1]._replace(step_result=step_result))
273 273
274 if step_result.retcode in step_config.ok_ret: 274 if step_result.retcode in step_config.ok_ret:
275 step_result.presentation.status = 'SUCCESS' 275 step_result.presentation.status = 'SUCCESS'
276 return step_result 276 return step_result
277 if not step_config.infra_step:
iannucci 2017/06/12 18:20:08 newline above
dnj 2017/06/12 19:00:03 Done.
278 state = 'FAILURE'
279 exc = recipe_api.StepFailure
277 else: 280 else:
278 if not step_config.infra_step: 281 state = 'EXCEPTION'
279 state = 'FAILURE' 282 exc = recipe_api.InfraFailure
280 exc = recipe_api.StepFailure
281 else:
282 state = 'EXCEPTION'
283 exc = recipe_api.InfraFailure
284 283
285 step_result.presentation.status = state 284 step_result.presentation.status = state
286 285
287 self._step_stack[-1].open_step.stream.write_line( 286 self._step_stack[-1].open_step.stream.write_line(
288 'step returned non-zero exit code: %d' % step_result.retcode) 287 'step returned non-zero exit code: %d' % step_result.retcode)
289 288
290 raise exc(step_config.name, step_result) 289 raise exc(step_config.name, step_result)
291 290
292 def run(self, recipe_script, api, properties): 291 def run(self, recipe_script, api, properties):
293 """Run a recipe represented by a recipe_script object. 292 """Run a recipe represented by a recipe_script object.
294 293
295 This function blocks until recipe finishes. 294 This function blocks until recipe finishes.
296 It mainly executes the recipe, and has some exception handling logic. 295 It mainly executes the recipe, and has some exception handling logic.
297 296
298 Args: 297 Args:
299 recipe_script: The recipe to run, as represented by a RecipeScript object. 298 recipe_script: The recipe to run, as represented by a RecipeScript object.
300 api: The api, with loaded module dependencies. 299 api: The api, with loaded module dependencies.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 ret = run_steps( 724 ret = run_steps(
726 properties, stream_engine, 725 properties, stream_engine,
727 step_runner.SubprocessStepRunner(stream_engine, engine_flags), 726 step_runner.SubprocessStepRunner(stream_engine, engine_flags),
728 universe_view, engine_flags=engine_flags, 727 universe_view, engine_flags=engine_flags,
729 emit_initial_properties=emit_initial_properties) 728 emit_initial_properties=emit_initial_properties)
730 finally: 729 finally:
731 os.chdir(old_cwd) 730 os.chdir(old_cwd)
732 731
733 return handle_recipe_return( 732 return handle_recipe_return(
734 ret, args.output_result_json, stream_engine, engine_flags) 733 ret, args.output_result_json, stream_engine, engine_flags)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698