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

Issue 2253943003: Formally define step config, pass to stream. (Closed)

Created:
4 years, 4 months ago by dnj
Modified:
4 years, 3 months ago
Reviewers:
iannucci, martiniss
CC:
chromium-reviews, infra-reviews+recipes-py_chromium.org
Base URL:
https://github.com/luci/recipes-py@nest-single-event
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Formally define step config, pass to stream. Formally define the step configuration dictionary members using a namedtuple. Replace instances of step dictionary and step dictionary manipulation with the new "recipe_api.StepConfig". Pass this new StepConfig struct to the "new_step_stream" stream API call instead of just some select step properties. The StreamEngine implementation is responsible for deciding how to process and/or use it. Similarly define a rendered StepConfig as a RenderedStep. Formally pass that around to components requiring a rendered value. This allows for greater control over the specification, manipulation, and consumption of this internal struct. Change expectation rendering to refrain from rendering empty StepConfig parameters. This means that if "cmd" is empty, it will just not appear, which is more consistent with the intent of the step than an empty list. BUG=chromium:628770 TEST=local Committed: https://github.com/luci/recipes-py/commit/be22c9a16dd89f9780e193a24edd98346870271d

Patch Set 1 #

Patch Set 2 : Rebase #

Total comments: 4

Patch Set 3 : Rebase, change parameter name. #

Patch Set 4 : Rebase #

Total comments: 17
Unified diffs Side-by-side diffs Delta from patch set Stats (+238 lines, -184 lines) Patch
M recipe_engine/recipe_api.py View 1 2 chunks +54 lines, -0 lines 13 comments Download
M recipe_engine/run.py View 1 2 3 5 chunks +13 lines, -29 lines 0 comments Download
M recipe_engine/simulation_test.py View 1 2 1 chunk +3 lines, -6 lines 0 comments Download
M recipe_engine/step_runner.py View 1 2 10 chunks +105 lines, -86 lines 3 comments Download
M recipe_engine/stream.py View 1 2 7 chunks +27 lines, -28 lines 0 comments Download
M recipe_engine/types.py View 2 chunks +4 lines, -4 lines 0 comments Download
M recipe_engine/unittests/stream_test.py View 1 3 chunks +10 lines, -9 lines 0 comments Download
M recipe_engine/util.py View 1 1 chunk +1 line, -1 line 0 comments Download
M recipe_modules/platform/example.expected/linux64.json View 1 chunk +0 lines, -1 line 1 comment Download
M recipe_modules/platform/example.expected/mac64.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/platform/example.expected/win32.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/api.py View 1 2 chunks +2 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/basic.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/catch_timeout.json View 1 chunk +8 lines, -0 lines 0 comments Download
M recipe_modules/step/example.expected/defer_results.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/exceptional.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/infra_failure.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/invalid_access.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipe_modules/step/example.expected/timeout.json View 1 chunk +8 lines, -0 lines 0 comments Download
M recipe_modules/step/example.expected/warning.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipes.py View 1 1 chunk +3 lines, -3 lines 0 comments Download
M recipes/engine_tests/trigger.expected/basic.json View 1 chunk +0 lines, -1 line 0 comments Download
M recipes/example/nested.expected/basic.json View 1 2 3 3 chunks +0 lines, -7 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 42 (37 generated)
martiniss
lgtm https://codereview.chromium.org/2253943003/diff/20001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2253943003/diff/20001/recipe_engine/step_runner.py#newcode175 recipe_engine/step_runner.py:175: step_config = None # Make sure we use ...
4 years, 3 months ago (2016-09-01 20:50:29 UTC) #2
dnj
https://codereview.chromium.org/2253943003/diff/20001/recipe_engine/step_runner.py File recipe_engine/step_runner.py (right): https://codereview.chromium.org/2253943003/diff/20001/recipe_engine/step_runner.py#newcode175 recipe_engine/step_runner.py:175: step_config = None # Make sure we use rendered ...
4 years, 3 months ago (2016-09-07 16:37:03 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2253943003/60001
4 years, 3 months ago (2016-09-12 19:07:11 UTC) #38
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://github.com/luci/recipes-py/commit/be22c9a16dd89f9780e193a24edd98346870271d
4 years, 3 months ago (2016-09-12 19:14:51 UTC) #40
iannucci
4 years, 3 months ago (2016-09-12 19:41:08 UTC) #42
Message was sent while issue was closed.
lgtm

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
File recipe_engine/recipe_api.py (right):

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:22: _StepConfig =
collections.namedtuple('StepConfig',
I would name this inner class _StepConfig too. Otherwise type errors may be hard
to debug.

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:28: """
StepConfig is the representation of a raw step as the recipe_engine sees it. You
should use the standard 'step' recipe module, which will construct and pass this
data to the engine for you, instead. The only reason why you would need to worry
about this object is if you're modifying the step module itself.

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:30: name: name of the step, will appear in buildbots
waterfall
let's add types to these, e.g.

name (str): ...

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:31: cmd: command to run, list of one or more strings
cmd (list): command to run. Acceptable types: str, Path, Placeholder

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:32: cwd: absolute path to working directory for the
command
cwd (Path): ...

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:33: env: dict with overrides for environment
variables
env (dict): overrides for environment variables. Each value is % formatted with
the entire existing os.environ. A value of `None` will remove that envvar from
the environ. e.g.
  {"envvar": "%(envvar)s;%(envvar2)s;extra",
   "delete_this": None,
   "static_value": "something" }

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:34: allow_subannotations: if True, lets the step
emit its own annotations
NOTE: Enabling this can cause some buggy behavior. Please strongly consider
using step_result.presentation instead. If you have questions, please contact
infra-dev@chromium.org.

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:35: trigger_specs: a list of trigger specifications,
see also _trigger_builds.
example schema? Actually... maybe another named tuple?

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:37: infra_step: if True, this is an infrastructure
step.
...... will raise InfraFailure instead of StepFailure.

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:40: ignored).
I think this (and stdin+stderr) actually must be Placeholders

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:44: ok_ret: Allowed return code list.
set of return codes allowed. If the step process returns something not on this
list, it will raise a StepFailure (or InfraFailure if infra_step==True).

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:45: step_test_data: Possible associated step test
data.
step_test_data (func -> recipe_test_api.StepTestData): A factory which returns a
StepTestData object that will be used as the default test data for this step.
The recipe author can override/augment this object in the GenTests function.

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/recipe_ap...
recipe_engine/recipe_api.py:46: nest_level: the step's nesting level.
int?

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/step_runn...
File recipe_engine/step_runner.py (right):

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/step_runn...
recipe_engine/step_runner.py:398: _STEP_CONFIG_RENDER_BLACKLIST = set((
frozenset

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/step_runn...
recipe_engine/step_runner.py:442: buf =
self._annotator.step_buffer(rendered_step.config.name)
why still use rendered_step here instead of rs?

https://codereview.chromium.org/2253943003/diff/60001/recipe_engine/step_runn...
recipe_engine/step_runner.py:450: self._step_history[rendered_step.config.name]
= rs
here too?

https://codereview.chromium.org/2253943003/diff/60001/recipe_modules/platform...
File recipe_modules/platform/example.expected/linux64.json (left):

https://codereview.chromium.org/2253943003/diff/60001/recipe_modules/platform...
recipe_modules/platform/example.expected/linux64.json:3: "cmd": [],
with the addition of step whitelisting, I think we should render this even when
it's empty. That will also make your recipe-roller experience much easier.

Powered by Google App Engine
This is Rietveld 408576698