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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/message_pool.py

Issue 2248653002: Revert of Fix pylint warnings in webkitpy/common/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual Revert (Patch Set 1 causes patch failure in read_checksum_from_png_unittest.py) Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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
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
40 """ 41 """
41 42
42 import cPickle 43 import cPickle
43 import logging 44 import logging
44 import multiprocessing 45 import multiprocessing
45 import Queue 46 import Queue
46 import sys 47 import sys
47 import traceback 48 import traceback
48 49
49 50
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 stack_utils.log_traceback(_log.error, exception_traceback) 304 stack_utils.log_traceback(_log.error, exception_traceback)
304 # Since tracebacks aren't picklable, send the extracted stack instead. 305 # Since tracebacks aren't picklable, send the extracted stack instead.
305 stack = traceback.extract_tb(exception_traceback) 306 stack = traceback.extract_tb(exception_traceback)
306 self._post(name='worker_exception', args=(exception_type, exception_valu e, stack), from_user=False) 307 self._post(name='worker_exception', args=(exception_type, exception_valu e, stack), from_user=False)
307 308
308 def _set_up_logging(self): 309 def _set_up_logging(self):
309 self._logger = logging.getLogger() 310 self._logger = logging.getLogger()
310 311
311 # The unix multiprocessing implementation clones any log handlers into t he child process, 312 # The unix multiprocessing implementation clones any log handlers into t he child process,
312 # so we remove them to avoid duplicate logging. 313 # so we remove them to avoid duplicate logging.
313 for handler in self._logger.handlers: 314 for h in self._logger.handlers:
314 self._logger.removeHandler(handler) 315 self._logger.removeHandler(h)
315 316
316 self._log_handler = _WorkerLogHandler(self) 317 self._log_handler = _WorkerLogHandler(self)
317 self._logger.addHandler(self._log_handler) 318 self._logger.addHandler(self._log_handler)
318 self._logger.setLevel(self.log_level) 319 self._logger.setLevel(self.log_level)
319 320
320 321
321 class _WorkerLogHandler(logging.Handler): 322 class _WorkerLogHandler(logging.Handler):
322 323
323 def __init__(self, worker): 324 def __init__(self, worker):
324 logging.Handler.__init__(self) 325 logging.Handler.__init__(self)
325 self._worker = worker 326 self._worker = worker
326 self.setLevel(worker.log_level) 327 self.setLevel(worker.log_level)
327 328
328 def emit(self, record): 329 def emit(self, record):
329 self._worker.log_messages.append(record) 330 self._worker.log_messages.append(record)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698