Changeset 122517 in webkit


Ignore:
Timestamp:
Jul 12, 2012 3:35:40 PM (12 years ago)
Author:
dpranke@chromium.org
Message:

webkitpy: clean up logging handlers, lint common.message_pool
https://bugs.webkit.org/show_bug.cgi?id=91152

Reviewed by Ojan Vafai.

The unix implementation of multiprocessing clones any logging
handlers from the parent process into the child; we currently
don't want this behavior in our code, so I was hand-removing the
installed handlers in the child process I knew about. After thinking
about it further, I think it was simpler and safe enough to just
remove all handlers in the child, since the message pool
propagates any message from the child back into the parent.

We can always change this in the future if it turns out to be an issue.

I'm also fixing a couple of other lint warnings while I'm at it.

  • Scripts/webkitpy/common/message_pool.py:

(_MessagePool.exit):
(_MessagePool._handle_worker_exception):
(_Worker._set_up_logging):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r122513 r122517  
     12012-07-12  Dirk Pranke  <dpranke@chromium.org>
     2
     3        webkitpy: clean up logging handlers, lint common.message_pool
     4        https://bugs.webkit.org/show_bug.cgi?id=91152
     5
     6        Reviewed by Ojan Vafai.
     7
     8        The unix implementation of multiprocessing clones any logging
     9        handlers from the parent process into the child; we currently
     10        don't want this behavior in our code, so I was hand-removing the
     11        installed handlers in the child process I knew about. After thinking
     12        about it further, I think it was simpler and safe enough to just
     13        remove all handlers in the child, since the message pool
     14        propagates any message from the child back into the parent.
     15       
     16        We can always change this in the future if it turns out to be an issue.
     17
     18        I'm also fixing a couple of other lint warnings while I'm at it.
     19
     20        * Scripts/webkitpy/common/message_pool.py:
     21        (_MessagePool.__exit__):
     22        (_MessagePool._handle_worker_exception):
     23        (_Worker._set_up_logging):
     24
    1252012-07-12  Dirk Pranke  <dpranke@chromium.org>
    226
  • trunk/Tools/Scripts/webkitpy/common/message_pool.py

    r122513 r122517  
    8383        return self
    8484
    85     def __exit__(self, exc_type, exc_value, traceback):
     85    def __exit__(self, exc_type, exc_value, exc_traceback):
    8686        self._close()
    8787        return False
     
    144144
    145145    @staticmethod
    146     def _handle_worker_exception(source, exception_type, exception_value, stack):
     146    def _handle_worker_exception(source, exception_type, exception_value, _):
    147147        if exception_type == KeyboardInterrupt:
    148148            raise exception_type(exception_value)
     
    289289        self._logger = logging.getLogger()
    290290
    291         # The unix multiprocessing implementation clones the MeteredStream log handler
    292         # into the child process, so we need to remove it to avoid duplicate logging.
     291        # The unix multiprocessing implementation clones any log handlers into the child process,
     292        # so we remove them to avoid duplicate logging.
    293293        for h in self._logger.handlers:
    294             # log handlers don't have names until python 2.7.
    295             # FIXME: log handler names should be passed in.
    296             if getattr(h, 'name', '') in ('MeteredStreamLogHandler', 'webkitpy.test.printer'):
    297                 self._logger.removeHandler(h)
    298                 break
     294            self._logger.removeHandler(h)
    299295
    300296        self._log_handler = _WorkerLogHandler(self)
Note: See TracChangeset for help on using the changeset viewer.