webkitpy should reply upon the multiprocessing package existing
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 00:27:36 +0000 (00:27 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 00:27:36 +0000 (00:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78176

Reviewed by Eric Seidel.

Now that we don't support Python 2.5, this import can't fail.

* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
(get):
(_Process):
(_Process.__init__):
(_Process.run):
* Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
(FunctionTests.test_get__processes):
(MultiProcessBrokerTests.setUp):
* Scripts/webkitpy/layout_tests/port/base.py:
(Port.__init__):
(Port.default_worker_model):
* Scripts/webkitpy/layout_tests/port/chromium_mac.py:
(ChromiumMacPort.check_build):
* Scripts/webkitpy/layout_tests/port/port_testcase.py:
(PortTestCase.test_default_worker_model):
* Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107151 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py
Tools/Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/base.py
Tools/Scripts/webkitpy/layout_tests/port/chromium_mac.py
Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py

index 73e5e21..d0f2672 100644 (file)
@@ -1,3 +1,29 @@
+2012-02-08  Adam Barth  <abarth@webkit.org>
+
+        webkitpy should reply upon the multiprocessing package existing
+        https://bugs.webkit.org/show_bug.cgi?id=78176
+
+        Reviewed by Eric Seidel.
+
+        Now that we don't support Python 2.5, this import can't fail.
+
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker.py:
+        (get):
+        (_Process):
+        (_Process.__init__):
+        (_Process.run):
+        * Scripts/webkitpy/layout_tests/controllers/manager_worker_broker_unittest.py:
+        (FunctionTests.test_get__processes):
+        (MultiProcessBrokerTests.setUp):
+        * Scripts/webkitpy/layout_tests/port/base.py:
+        (Port.__init__):
+        (Port.default_worker_model):
+        * Scripts/webkitpy/layout_tests/port/chromium_mac.py:
+        (ChromiumMacPort.check_build):
+        * Scripts/webkitpy/layout_tests/port/port_testcase.py:
+        (PortTestCase.test_default_worker_model):
+        * Scripts/webkitpy/layout_tests/run_webkit_tests_integrationtest.py:
+
 2012-02-08  Gustavo Noronha Silva  <gns@gnome.org>
 
         Unreviewed typo fix that makes docs build again for the gtk2-based
index 82ba91f..34136ff 100755 (executable)
@@ -42,17 +42,11 @@ They interact more or less like:
 """
 
 import logging
+import multiprocessing
 import optparse
 import Queue
 import sys
 
-
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 # These are needed when workers are launched in new child processes.
 from webkitpy.common.host import Host
 from webkitpy.common.host_mock import MockHost
@@ -99,7 +93,7 @@ def get(port, options, client, worker_class):
     if worker_model == 'inline':
         queue_class = Queue.Queue
         manager_class = _InlineManager
-    elif worker_model == 'processes' and multiprocessing:
+    elif worker_model == 'processes':
         queue_class = multiprocessing.Queue
         manager_class = _MultiProcessManager
     else:
@@ -245,40 +239,38 @@ class _InlineWorkerConnection(_WorkerConnection):
         raise exc_info[0], exc_info[1], exc_info[2]
 
 
-if multiprocessing:
-
-    class _Process(multiprocessing.Process):
-        def __init__(self, worker_connection, platform_name, options, client):
-            multiprocessing.Process.__init__(self)
-            self._worker_connection = worker_connection
-            self._platform_name = platform_name
-            self._options = options
-            self._client = client
-
-        def run(self):
-            # We need to create a new Host object here because this is
-            # running in a new process and we can't require the parent's
-            # Host to be pickleable and passed to the child.
-            if self._platform_name.startswith('test'):
-                host = MockHost()
-            else:
-                host = Host()
-            host._initialize_scm()
-
-            options = self._options
-            port_obj = host.port_factory.get(self._platform_name, options)
-
-            # The unix multiprocessing implementation clones the
-            # log handler configuration into the child processes,
-            # but the win implementation doesn't.
-            configure_logging = (sys.platform == 'win32')
-
-            # FIXME: this won't work if the calling process is logging
-            # somewhere other than sys.stderr and sys.stdout, but I'm not sure
-            # if this will be an issue in practice.
-            printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging)
-            self._client.run(port_obj)
-            printer.cleanup()
+class _Process(multiprocessing.Process):
+    def __init__(self, worker_connection, platform_name, options, client):
+        multiprocessing.Process.__init__(self)
+        self._worker_connection = worker_connection
+        self._platform_name = platform_name
+        self._options = options
+        self._client = client
+
+    def run(self):
+        # We need to create a new Host object here because this is
+        # running in a new process and we can't require the parent's
+        # Host to be pickleable and passed to the child.
+        if self._platform_name.startswith('test'):
+            host = MockHost()
+        else:
+            host = Host()
+        host._initialize_scm()
+
+        options = self._options
+        port_obj = host.port_factory.get(self._platform_name, options)
+
+        # The unix multiprocessing implementation clones the
+        # log handler configuration into the child processes,
+        # but the win implementation doesn't.
+        configure_logging = (sys.platform == 'win32')
+
+        # FIXME: this won't work if the calling process is logging
+        # somewhere other than sys.stderr and sys.stdout, but I'm not sure
+        # if this will be an issue in practice.
+        printer = printing.Printer(port_obj, options, sys.stderr, sys.stdout, configure_logging)
+        self._client.run(port_obj)
+        printer.cleanup()
 
 
 class _MultiProcessWorkerConnection(_WorkerConnection):
index 8e63f93..e41e22c 100644 (file)
@@ -31,15 +31,8 @@ import Queue
 import sys
 import unittest
 
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
-
 from webkitpy.common.system import outputcapture
 from webkitpy.common.host_mock import MockHost
-
 from webkitpy.layout_tests import port
 from webkitpy.layout_tests.controllers import manager_worker_broker
 from webkitpy.layout_tests.controllers import message_broker
@@ -127,11 +120,7 @@ class FunctionTests(unittest.TestCase):
         # This test sometimes fails on Windows. See <http://webkit.org/b/55087>.
         if sys.platform in ('cygwin', 'win32'):
             return
-
-        if multiprocessing:
-            self.assertTrue(make_broker(self, 'processes') is not None)
-        else:
-            self.assertRaises(ValueError, make_broker, self, 'processes')
+        self.assertTrue(make_broker(self, 'processes') is not None)
 
     def test_get__unknown(self):
         self.assertRaises(ValueError, make_broker, self, 'unknown')
@@ -205,16 +194,13 @@ class _TestsMixin(object):
 
 
 # FIXME: https://bugs.webkit.org/show_bug.cgi?id=54520.
-if multiprocessing and sys.platform not in ('cygwin', 'win32'):
+if sys.platform not in ('cygwin', 'win32'):
 
     class MultiProcessBrokerTests(_TestsMixin, unittest.TestCase):
         def setUp(self):
             _TestsMixin.setUp(self)
             self._worker_model = 'processes'
 
-        def queue(self):
-            return multiprocessing.Queue()
-
 
 class FunctionsTest(unittest.TestCase):
     def test_runtime_options(self):
index ba2c382..10e2a82 100755 (executable)
@@ -38,14 +38,6 @@ import re
 
 from webkitpy.common.memoized import memoized
 from webkitpy.common.system import path
-
-
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 from webkitpy.common import find_files
 from webkitpy.common.system import logutils
 from webkitpy.common.system.executive import ScriptError
@@ -148,7 +140,6 @@ class Port(object):
             self.set_option_default('configuration', self.default_configuration())
         self._test_configuration = None
         self._reftest_list = {}
-        self._multiprocessing_is_available = (multiprocessing is not None)
         self._results_directory = None
 
     def wdiff_available(self):
@@ -176,9 +167,7 @@ class Port(object):
         return cpu_count
 
     def default_worker_model(self):
-        if self._multiprocessing_is_available:
-            return 'processes'
-        return 'inline'
+        return 'processes'
 
     def baseline_path(self):
         """Return the absolute path to the directory to store new baselines in for this port."""
index e6d557f..30f4aa9 100644 (file)
@@ -102,13 +102,6 @@ class ChromiumMacPort(chromium.ChromiumPort):
 
         return result
 
-    def default_child_processes(self):
-        if not self._multiprocessing_is_available:
-            # Running multiple threads in Mac Python is unstable (See
-            # https://bugs.webkit.org/show_bug.cgi?id=38553 for more info).
-            return 1
-        return chromium.ChromiumPort.default_child_processes(self)
-
     def operating_system(self):
         return 'mac'
 
index 38b54fe..8df039c 100755 (executable)
 
 import errno
 import socket
-
 import sys
 import time
 import unittest
 
-# Handle Python < 2.6 where multiprocessing isn't available.
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 from webkitpy.layout_tests.servers import http_server_base
-
 from webkitpy.common.system.filesystem_mock import MockFileSystem
 from webkitpy.tool.mocktool import MockOptions
 from webkitpy.common.system.executive_mock import MockExecutive
@@ -68,10 +60,7 @@ class PortTestCase(unittest.TestCase):
 
     def test_default_worker_model(self):
         port = self.make_port()
-        if multiprocessing:
-            self.assertEqual(port.default_worker_model(), 'processes')
-        else:
-            self.assertEqual(port.default_worker_model(), 'inline')
+        self.assertEqual(port.default_worker_model(), 'processes')
 
     def test_driver_cmd_line(self):
         port = self.make_port()
index 3f31e6b..ac9f8bb 100755 (executable)
@@ -43,14 +43,9 @@ import unittest
 
 from webkitpy.common.system import path
 
-try:
-    import multiprocessing
-except ImportError:
-    multiprocessing = None
-
 # FIXME: remove this when we fix test-webkitpy to work properly on cygwin
 # (bug 63846).
-SHOULD_TEST_PROCESSES = multiprocessing and sys.platform not in ('cygwin', 'win32')
+SHOULD_TEST_PROCESSES = sys.platform not in ('cygwin', 'win32')
 
 from webkitpy.common import array_stream
 from webkitpy.common.system import outputcapture