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

Side by Side Diff: recipe_modules/step/api.py

Issue 2253943003: Formally define step config, pass to stream. (Closed) Base URL: https://github.com/luci/recipes-py@nest-single-event
Patch Set: Rebase 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
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 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 import contextlib 5 import contextlib
6 import datetime
6 7
7 from recipe_engine import recipe_api 8 from recipe_engine import recipe_api
8 9
9 10
10 # Inherit from RecipeApiPlain because the only thing which is a step is 11 # Inherit from RecipeApiPlain because the only thing which is a step is
11 # run_from_dict() 12 # run_from_dict()
12 class StepApi(recipe_api.RecipeApiPlain): 13 class StepApi(recipe_api.RecipeApiPlain):
13 def __init__(self, **kwargs): 14 def __init__(self, **kwargs):
14 super(StepApi, self).__init__(**kwargs) 15 super(StepApi, self).__init__(**kwargs)
15 self._step_names = {} 16 self._step_names = {}
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if 'cwd' not in kwargs: 157 if 'cwd' not in kwargs:
157 kwargs['cwd'] = compositor.get('cwd') 158 kwargs['cwd'] = compositor.get('cwd')
158 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {})) 159 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {}))
159 kwargs['infra_step'] = compositor.get_with_context( 160 kwargs['infra_step'] = compositor.get_with_context(
160 'infra_step', bool(infra_step)) 161 'infra_step', bool(infra_step))
161 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0) 162 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0)
162 kwargs['name'] = full_name 163 kwargs['name'] = full_name
163 164
164 schema = self.make_config() 165 schema = self.make_config()
165 schema.set_val(kwargs) 166 schema.set_val(kwargs)
166 return self.run_from_dict(self._engine.create_step(schema)) 167 return self.run_from_dict(schema.as_jsonish())
167 168
168 # TODO(martiniss) delete, and make generator_script use **kwargs on step() 169 # TODO(martiniss) delete, and make generator_script use **kwargs on step()
169 @recipe_api.composite_step 170 @recipe_api.composite_step
170 def run_from_dict(self, dct): 171 def run_from_dict(self, dct):
171 return self._engine.run_step(dct) 172 return self._engine.run_step(dct)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698