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

Unified Diff: recipe_engine/run.py

Issue 2802693003: include Package proto into Result proto (Closed)
Patch Set: rebased and addressed comments Created 3 years, 7 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
« no previous file with comments | « recipe_engine/result_pb2.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/run.py
diff --git a/recipe_engine/run.py b/recipe_engine/run.py
index 8878152176499e68f32dff9e53b2094ee9c72dc5..c6d98ce5cc025603658c10dd003bd8dc53991d0f 100644
--- a/recipe_engine/run.py
+++ b/recipe_engine/run.py
@@ -156,6 +156,7 @@ def run_steps(properties, stream_engine, step_runner, universe_view,
s.set_step_status('EXCEPTION')
if engine_flags and engine_flags.use_result_proto:
return result_pb2.Result(
+ recipe_package=universe_view.universe.config_file.read(),
failure=result_pb2.Failure(
human_reason=str(e),
exception=result_pb2.Exception(
@@ -308,49 +309,36 @@ class RecipeEngine(object):
return self._old_run(recipe_script, api, properties)
def _new_run(self, recipe_script, api, properties):
- result = None
+ result = result_pb2.Result(
+ recipe_package=self.universe.config_file.read(),
+ )
with self._step_runner.run_context():
try:
try:
recipe_result = recipe_script.run(api, properties)
- result = result_pb2.Result(json_result=json.dumps(recipe_result))
+ result.json_result = json.dumps(recipe_result)
finally:
self._close_through_level(0)
except recipe_api.StepFailure as f:
- result = result_pb2.Result(
- failure=result_pb2.Failure(
- human_reason=f.reason,
- failure=result_pb2.StepFailure(
- step=f.name
- )))
+ result.failure.human_reason = f.reason
+ result.failure.failure.step = f.name
except types.StepDataAttributeError as ex:
- result = result_pb2.Result(
- failure=result_pb2.Failure(
- human_reason=ex.message,
- step_data=result_pb2.StepData(
- step=f.name
- )))
+ result.failure.human_reason = ex.message
+ result.failure.step_data.step = f.name
# Let the step runner run_context decide what to do.
raise
except subprocess42.TimeoutExpired as ex:
- result = result_pb2.Result(
- failure=result_pb2.Failure(
- human_reason="Step time out: %r" % ex,
- timeout= result_pb2.Timeout(
- timeout_s=ex.timeout
- )))
+ result.failure.human_reason = "Step time out: %r" % ex
+ result.failure.timeout.timeout_s = ex.timeout
except Exception as ex:
- result = result_pb2.Result(
- failure=result_pb2.Failure(
- human_reason="Uncaught Exception: %r" % ex,
- exception=result_pb2.Exception(
- traceback=traceback.format_exc().splitlines()
- )))
+ result.failure.human_reason = "Uncaught Exception: %r" % ex
+ result.failure.exception.traceback[:] = (
+ traceback.format_exc().splitlines())
# Let the step runner run_context decide what to do.
raise
« no previous file with comments | « recipe_engine/result_pb2.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698