Chromium Code Reviews| Index: gclient_utils.py |
| =================================================================== |
| --- gclient_utils.py (revision 104208) |
| +++ gclient_utils.py (working copy) |
| @@ -247,7 +247,7 @@ |
| return new_fileobj |
| -def MakeFileAnnotated(fileobj, include_zero=False): |
| +def MakeFileAnnotated(fileobj): |
|
M-A Ruel
2011/10/06 00:57:34
Please git svn rebase or svn up correctly.
|
| """Creates a file object clone to automatically prepends every line in worker |
| threads with a NN> prefix.""" |
| if hasattr(fileobj, 'output_buffers'): |
| @@ -265,11 +265,9 @@ |
| def annotated_write(out): |
| index = getattr(threading.currentThread(), 'index', None) |
| if index is None: |
| - if not include_zero: |
| - # Unindexed threads aren't buffered. |
| - new_fileobj.old_annotated_write(out) |
| - return |
| - index = 0 |
| + # Undexed threads aren't buffered. |
| + new_fileobj.old_annotated_write(out) |
| + return |
| new_fileobj.lock.acquire() |
| try: |
| @@ -360,6 +358,9 @@ |
| else: |
| filter_fn(in_line) |
| in_line = '' |
| + else: |
| + filter_fn(in_line) |
| + in_line = '' |
| in_byte = kid.stdout.read(1) |
| # Flush the rest of buffered output. This is only an issue with |
| # stdout/stderr not ending with a \n. |
| @@ -497,11 +498,7 @@ |
| def requirements(self): |
| return tuple(self._requirements) |
| - @lockedmethod |
| - def add_requirement(self, new): |
| - self._requirements.add(new) |
| - |
| class ExecutionQueue(object): |
| """Runs a set of WorkItem that have interdependencies and were WorkItem are |
| added as they are processed. |
| @@ -563,7 +560,7 @@ |
| self._flush_terminated_threads() |
| if (not self.queued and not self.running or |
| self.jobs == len(self.running)): |
| - logging.debug('No more worker threads or can\'t queue anything.') |
| + # No more worker threads or can't queue anything. |
| break |
| # Check for new tasks to start. |
| @@ -650,7 +647,7 @@ |
| """One thread to execute one WorkItem.""" |
| def __init__(self, item, index, args, kwargs): |
| threading.Thread.__init__(self, name=item.name or 'Worker') |
| - logging.info('_Worker(%s) reqs:%s' % (item.name, item.requirements)) |
| + logging.info(item.name) |
| self.item = item |
| self.index = index |
| self.args = args |
| @@ -658,7 +655,7 @@ |
| def run(self): |
| """Runs in its own thread.""" |
| - logging.debug('_Worker.run(%s)' % self.item.name) |
| + logging.debug('running(%s)' % self.item.name) |
| work_queue = self.kwargs['work_queue'] |
| try: |
| self.item.run(*self.args, **self.kwargs) |
| @@ -667,7 +664,7 @@ |
| logging.info('Caught exception in thread %s' % self.item.name) |
| logging.info(str(sys.exc_info())) |
| work_queue.exceptions.put(sys.exc_info()) |
| - logging.info('_Worker.run(%s) done' % self.item.name) |
| + logging.info('Task %s done' % self.item.name) |
| work_queue.ready_cond.acquire() |
| try: |