Title: [122517] trunk/Tools
Revision
122517
Author
[email protected]
Date
2012-07-12 15:35:40 -0700 (Thu, 12 Jul 2012)

Log 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (122516 => 122517)


--- trunk/Tools/ChangeLog	2012-07-12 22:33:36 UTC (rev 122516)
+++ trunk/Tools/ChangeLog	2012-07-12 22:35:40 UTC (rev 122517)
@@ -1,5 +1,29 @@
 2012-07-12  Dirk Pranke  <[email protected]>
 
+        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):
+
+2012-07-12  Dirk Pranke  <[email protected]>
+
         webkitpy: rename manager_worker_broker to message_pool
         https://bugs.webkit.org/show_bug.cgi?id=91145
 

Modified: trunk/Tools/Scripts/webkitpy/common/message_pool.py (122516 => 122517)


--- trunk/Tools/Scripts/webkitpy/common/message_pool.py	2012-07-12 22:33:36 UTC (rev 122516)
+++ trunk/Tools/Scripts/webkitpy/common/message_pool.py	2012-07-12 22:35:40 UTC (rev 122517)
@@ -82,7 +82,7 @@
     def __enter__(self):
         return self
 
-    def __exit__(self, exc_type, exc_value, traceback):
+    def __exit__(self, exc_type, exc_value, exc_traceback):
         self._close()
         return False
 
@@ -143,7 +143,7 @@
         self._workers_stopped.add(source)
 
     @staticmethod
-    def _handle_worker_exception(source, exception_type, exception_value, stack):
+    def _handle_worker_exception(source, exception_type, exception_value, _):
         if exception_type == KeyboardInterrupt:
             raise exception_type(exception_value)
         _log.error("%s raised %s('%s'):" % (
@@ -288,14 +288,10 @@
     def _set_up_logging(self):
         self._logger = logging.getLogger()
 
-        # The unix multiprocessing implementation clones the MeteredStream log handler
-        # into the child process, so we need to remove it to avoid duplicate logging.
+        # The unix multiprocessing implementation clones any log handlers into the child process,
+        # so we remove them to avoid duplicate logging.
         for h in self._logger.handlers:
-            # log handlers don't have names until python 2.7.
-            # FIXME: log handler names should be passed in.
-            if getattr(h, 'name', '') in ('MeteredStreamLogHandler', 'webkitpy.test.printer'):
-                self._logger.removeHandler(h)
-                break
+            self._logger.removeHandler(h)
 
         self._log_handler = _WorkerLogHandler(self)
         self._logger.addHandler(self._log_handler)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to