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

Unified Diff: recipe_engine/step_runner.py

Issue 2332833003: Add better documentation, trigger namedtuple. (Closed)
Patch Set: More cleanups. 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 side-by-side diff with in-line comments
Download patch
Index: recipe_engine/step_runner.py
diff --git a/recipe_engine/step_runner.py b/recipe_engine/step_runner.py
index 1b0448c97fcdbab3ddcaf13e34db2e5380684fc1..dc3589dbe3249f0084bf46161a683616094774f1 100644
--- a/recipe_engine/step_runner.py
+++ b/recipe_engine/step_runner.py
@@ -354,22 +354,22 @@ class SubprocessStepRunner(StepRunner):
def _trigger_builds(self, step, trigger_specs):
assert trigger_specs is not None
for trig in trigger_specs:
- builder_name = trig.get('builder_name')
+ builder_name = trig.builder_name
if not builder_name:
raise ValueError('Trigger spec: builder_name is not set')
- changes = trig.get('buildbot_changes', [])
+ changes = trig.buildbot_changes or []
assert isinstance(changes, list), 'buildbot_changes must be a list'
changes = map(self._normalize_change, changes)
step.trigger(json.dumps({
'builderNames': [builder_name],
- 'bucket': trig.get('bucket'),
+ 'bucket': trig.bucket,
'changes': changes,
# if True and triggering fails asynchronously, fail entire build.
- 'critical': trig.get('critical', True),
- 'properties': trig.get('properties'),
- 'tags': trig.get('tags'),
+ 'critical': trig.critical,
+ 'properties': trig.properties,
+ 'tags': trig.tags,
}, sort_keys=True))
def _normalize_change(self, change):
@@ -393,15 +393,6 @@ class SimulationStepRunner(StepRunner):
values.
"""
- # List of attributes in a recipe_api.StepConfig to omit when rendering
- # step history.
- _STEP_CONFIG_RENDER_BLACKLIST = set((
- 'nest_level',
- 'ok_ret',
- 'infra_step',
- 'step_test_data',
- ))
-
def __init__(self, stream_engine, test_data, annotator):
self._test_data = test_data
self._stream_engine = stream_engine
@@ -439,7 +430,7 @@ class SimulationStepRunner(StepRunner):
# note that '~' sorts after 'z' so that this will be last on each
# step. also use _step to get access to the mutable step
# dictionary.
- buf = self._annotator.step_buffer(rendered_step.config.name)
+ buf = self._annotator.step_buffer(rs.config.name)
lines = filter(None, buf.getvalue()).splitlines()
lines = [stream.encode_str(x) for x in lines]
if lines:
@@ -447,7 +438,7 @@ class SimulationStepRunner(StepRunner):
# added step_config to.
rs = rs._replace(followup_annotations=lines)
step_stream.close()
- self._step_history[rendered_step.config.name] = rs
+ self._step_history[rs.config.name] = rs
@property
def stream(inner):
@@ -473,8 +464,7 @@ class SimulationStepRunner(StepRunner):
self._test_data.expected_exception))
def _rendered_step_to_dict(self, rs):
- d = dict((k, v) for k, v in rs.config._asdict().iteritems()
- if v and k not in self._STEP_CONFIG_RENDER_BLACKLIST)
+ d = rs.config.render_to_dict()
if rs.followup_annotations:
d['~followup_annotations'] = rs.followup_annotations
return d
« recipe_engine/recipe_api.py ('K') | « recipe_engine/run.py ('k') | recipe_engine/stream.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698