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

Unified Diff: recipes.py

Issue 2265673002: Add LogDog / annotation protobuf support. (Closed) Base URL: https://github.com/luci/recipes-py@step-formal-struct
Patch Set: pylint, fix comments 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
« recipe_engine/stream_logdog.py ('K') | « recipe_modules/step/config.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 744aa6f5d6e4215f253ffbf954d25c2ead5a46df..24c932c84a151c86b7a5a951b8b73edb1b514c04 100755
--- a/recipes.py
+++ b/recipes.py
@@ -92,6 +92,7 @@ def run(package_deps, args, op_args):
from recipe_engine import loader
from recipe_engine import step_runner
from recipe_engine import stream
+ from recipe_engine import stream_logdog
def get_properties_from_args(args):
properties = dict(x.split('=', 1) for x in args)
@@ -152,12 +153,35 @@ def run(package_deps, args, op_args):
old_cwd = os.getcwd()
os.chdir(workdir)
- stream_engine = stream.ProductStreamEngine(
- stream.StreamEngineInvariants(),
- stream.AnnotatorStreamEngine(
+
+ # Construct our stream engine.
+ #
+ # We begin with a ProductStreamEngine seeded with StreamEngineInvariants. As
+ # we evaluate our configuration, we will append additional StreamEngine
+ # instances to the ProductStreamEngine.
+ stream_engine = stream.ProductStreamEngine(stream.StreamEngineInvariants())
+
+ def build_annotation_stream_engine():
+ return stream.AnnotatorStreamEngine(
sys.stdout,
emit_timestamps=(args.timestamps or
- op_args.annotation_flags.emit_timestamp)))
+ op_args.annotation_flags.emit_timestamp),
+ )
+
+ if op_args.logdog.streamserver_uri:
+ logging.debug('Using LogDog with parameters [%v]', op_args.logdog)
+ stream_engine.append_stream_engine(stream_logdog.StreamEngine(
+ streamserver_uri=op_args.logdog.streamserver_uri,
+ name_base=(op_args.logdog.name_base or None),
+ ))
+
+ # If we're teeing, also fold in a standard annotation stream engine.
+ if op_args.logdog.tee:
+ stream_engine.append_stream_engine(build_annotation_stream_engine())
+ else:
+ # Not using LogDog; use a standard annotation stream engine.
+ stream_engine.append_stream_engine(build_annotation_stream_engine())
+
with stream_engine:
# Emit initial properties if configured to do so.
if op_args.annotation_flags.emit_initial_properties:
« recipe_engine/stream_logdog.py ('K') | « recipe_modules/step/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698