| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 and test-webkitpy. This module follows the design for multiprocessing.Pool | 30 and test-webkitpy. This module follows the design for multiprocessing.Pool |
| 31 and concurrency.futures.ProcessPoolExecutor, with the following differences: | 31 and concurrency.futures.ProcessPoolExecutor, with the following differences: |
| 32 | 32 |
| 33 * Tasks are executed in stateful subprocesses via objects that implement the | 33 * Tasks are executed in stateful subprocesses via objects that implement the |
| 34 Worker interface - this allows the workers to share state across tasks. | 34 Worker interface - this allows the workers to share state across tasks. |
| 35 * The pool provides an asynchronous event-handling interface so the caller | 35 * The pool provides an asynchronous event-handling interface so the caller |
| 36 may receive events as tasks are processed. | 36 may receive events as tasks are processed. |
| 37 | 37 |
| 38 If you don't need these features, use multiprocessing.Pool or concurrency.future
s | 38 If you don't need these features, use multiprocessing.Pool or concurrency.future
s |
| 39 instead. | 39 instead. |
| 40 | |
| 41 """ | 40 """ |
| 42 | 41 |
| 43 import cPickle | 42 import cPickle |
| 44 import logging | 43 import logging |
| 45 import multiprocessing | 44 import multiprocessing |
| 46 import Queue | 45 import Queue |
| 47 import sys | 46 import sys |
| 48 import traceback | 47 import traceback |
| 49 | 48 |
| 50 | 49 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 | 320 |
| 322 class _WorkerLogHandler(logging.Handler): | 321 class _WorkerLogHandler(logging.Handler): |
| 323 | 322 |
| 324 def __init__(self, worker): | 323 def __init__(self, worker): |
| 325 logging.Handler.__init__(self) | 324 logging.Handler.__init__(self) |
| 326 self._worker = worker | 325 self._worker = worker |
| 327 self.setLevel(worker.log_level) | 326 self.setLevel(worker.log_level) |
| 328 | 327 |
| 329 def emit(self, record): | 328 def emit(self, record): |
| 330 self._worker.log_messages.append(record) | 329 self._worker.log_messages.append(record) |
| OLD | NEW |