[llvm] r193463 - lit: handle late multiprocessing errors gracefully
Alp Toker
alp at nuanti.com
Sat Oct 26 01:22:45 PDT 2013
Author: alp
Date: Sat Oct 26 03:22:44 2013
New Revision: 193463
URL: http://llvm.org/viewvc/llvm-project?rev=193463&view=rev
Log:
lit: handle late multiprocessing errors gracefully
This should be a better fix for lit multiprocessing failures, replacing the
OpenBSD and FreeBSD workarounds in r193413 and r193457.
Reference: http://bugs.python.org/issue3770
Modified:
llvm/trunk/utils/lit/lit/main.py
llvm/trunk/utils/lit/lit/run.py
Modified: llvm/trunk/utils/lit/lit/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=193463&r1=193462&r2=193463&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/main.py (original)
+++ llvm/trunk/utils/lit/lit/main.py Sat Oct 26 03:22:44 2013
@@ -111,8 +111,7 @@ def write_test_results(run, lit_config,
def main(builtinParameters = {}):
# Use processes by default on Unix platforms.
isWindows = platform.system() == 'Windows'
- # multiprocessing is broken on various BSD Python versions: http://bugs.python.org/issue3770
- useProcessesIsDefault = (not isWindows) and ('BSD' not in platform.system())
+ useProcessesIsDefault = not isWindows
global options
from optparse import OptionParser, OptionGroup
Modified: llvm/trunk/utils/lit/lit/run.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/run.py?rev=193463&r1=193462&r2=193463&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/run.py (original)
+++ llvm/trunk/utils/lit/lit/run.py Sat Oct 26 03:22:44 2013
@@ -209,16 +209,20 @@ class Run(object):
"""
# Choose the appropriate parallel execution implementation.
- if jobs == 1 or not use_processes or multiprocessing is None:
+ if jobs != 1 and use_processes and multiprocessing:
+ try:
+ task_impl = multiprocessing.Process
+ queue_impl = multiprocessing.Queue
+ canceled_flag = multiprocessing.Value('i', 0)
+ consumer = MultiprocessResultsConsumer(self, display, jobs)
+ except ImportError:
+ # Workaround for BSD: http://bugs.python.org/issue3770
+ consumer = None
+ if not consumer:
task_impl = threading.Thread
queue_impl = queue.Queue
canceled_flag = LockedValue(0)
consumer = ThreadResultsConsumer(display)
- else:
- task_impl = multiprocessing.Process
- queue_impl = multiprocessing.Queue
- canceled_flag = multiprocessing.Value('i', 0)
- consumer = MultiprocessResultsConsumer(self, display, jobs)
# Create the test provider.
provider = TestProvider(self.tests, jobs, queue_impl, canceled_flag)
More information about the llvm-commits
mailing list