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

Unified Diff: tools/sharding_supervisor/stdio_buffer.py

Issue 65143003: GTTF: Remove obsolete sharding_supervisor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « tools/sharding_supervisor/sharding_supervisor.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/sharding_supervisor/stdio_buffer.py
diff --git a/tools/sharding_supervisor/stdio_buffer.py b/tools/sharding_supervisor/stdio_buffer.py
deleted file mode 100644
index d16220a19812c9e7f38ee5413a53b4c23c3edfd7..0000000000000000000000000000000000000000
--- a/tools/sharding_supervisor/stdio_buffer.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Syncronized Standard IO Linebuffer implemented with cStringIO."""
-
-import cStringIO
-import threading
-import Queue
-
-
-class StdioBuffer(object):
- def __init__(self, shard):
- self.queue = Queue.Queue()
- self.completed = 0
- self.shard = shard
-
- def _pipe_handler(self, system_pipe, program_pipe):
- """Helper method for collecting stdio output. Output is collected until
- a newline is seen, at which point an event is triggered and the line is
- pushed to a buffer as a (stdio, line) tuple."""
- buf = cStringIO.StringIO()
- pipe_running = True
- while pipe_running:
- char = program_pipe.read(1)
- if not char and self.shard.poll() is not None:
- pipe_running = False
- buf.write(char)
- if char == '\n' or not pipe_running:
- line = buf.getvalue()
- if line:
- self.queue.put((system_pipe, line))
- if not pipe_running:
- self.queue.put((system_pipe, None))
- buf.close()
- buf = cStringIO.StringIO()
-
- def handle_pipe(self, system_pipe, program_pipe):
- t = threading.Thread(target=self._pipe_handler, args=[system_pipe,
- program_pipe])
- t.start()
- return t
-
- def readline(self):
- """Emits a tuple of (sys.stderr, line), (sys.stdout, line), or (None, None)
- if the process has finished. This is a blocking call."""
- while True:
- (pipe, line) = self.queue.get(True)
- if line:
- return (pipe, line)
- self.completed += 1
- if self.completed >= 2:
- return (None, None)
« no previous file with comments | « tools/sharding_supervisor/sharding_supervisor.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698