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

Unified Diff: recipes.py

Issue 2052543003: Emit CURRENT_TIMESTAMP annotation (Closed) Base URL: git@github.com:luci/recipes-py.git@master
Patch Set: nit Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « recipe_engine/unittests/stream_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipes.py
diff --git a/recipes.py b/recipes.py
index 52e2fb6a07c6ebefc811b04c8c4bbe3bba82be32..d66de189297502ec658dd5013d30600a1460410d 100755
--- a/recipes.py
+++ b/recipes.py
@@ -138,18 +138,17 @@ def run(package_deps, args):
os.chdir(workdir)
stream_engine = stream.ProductStreamEngine(
stream.StreamEngineInvariants(),
- stream.AnnotatorStreamEngine(sys.stdout))
+ stream.AnnotatorStreamEngine(sys.stdout, emit_timestamps=args.timestamps))
+ with stream_engine:
+ try:
+ ret = recipe_run.run_steps(
+ properties, stream_engine,
+ step_runner.SubprocessStepRunner(stream_engine),
+ universe=universe)
+ finally:
+ os.chdir(old_cwd)
- try:
- ret = recipe_run.run_steps(
- properties, stream_engine,
- step_runner.SubprocessStepRunner(stream_engine),
- universe=universe)
-
- finally:
- os.chdir(old_cwd)
-
- return handle_recipe_return(ret, args.output_result_json, stream_engine)
+ return handle_recipe_return(ret, args.output_result_json, stream_engine)
def remote_run(args):
@@ -295,9 +294,21 @@ def main():
'recipe',
help='The recipe to execute')
run_p.add_argument(
- 'props', nargs=argparse.REMAINDER,
+ 'props',
+ nargs=argparse.REMAINDER,
help='A list of property pairs; e.g. mastername=chromium.linux '
'issue=12345')
+ run_p.add_argument(
+ '--timestamps',
+ action='store_true',
+ help='If true, emit CURRENT_TIMESTAMP annotations. '
+ 'Default: false. '
+ 'CURRENT_TIMESTAMP annotation has one parameter, current time in '
+ 'Unix timestamp format. '
+ 'CURRENT_TIMESTAMP annotation will be printed at the beginning and '
+ 'end of the annotation stream and also immediately before each '
+ 'STEP_START and STEP_END annotations.',
+ )
remote_run_p = subp.add_parser(
'remote_run',
« no previous file with comments | « recipe_engine/unittests/stream_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698