[PATCH] Use processes instead of threads
Nathaniel Smith
njs at pobox.com
Thu Apr 29 01:47:26 UTC 2004
Due to an interesting feature of python's thread implementation, all
processes spawned by a non-main thread start with all signals blocked.
Currently, if you run qmtest with -j<anything except 1>, all tests are
run by a non-main thread, and thus all processes spawned ignore
ulimits, cannot be killed except by SIGKILL, etc.
The proposed change is to, by default, use processes instead of
threads to achieve concurrent execution. This is a bit more
expensive, but not radically: running the throughput benchmark in the
qmtest repository with 10,000 tests, we go from ~7.5s to ~10.75s.
This looks like a big difference in terms of ratios, but it's the
absolute difference that actually matters, and a few seconds overhead
will be swallowed up completely if one is running tests that actually
take any time of their own.
Using processes may be somewhat less robust, since there's this extra
complication of tracking down a working qmtest executable and spawning
it. Probably the ideal target would use threads on windows and fork()
on Linux. But this ideal target hasn't been written yet...
This only fixes the bug when using "qmtest run"; tests run from the
gui still experience the bug, because the gui always runs all tests in
a separate thread.
Comments?
-- Nathaniel
--
Sentience can be such a burden.
-------------- next part --------------
? results.qmr
? qm/external/__init__.pyc
? qm/test/classes/csl-notes
? tests/regress/QMTest/regression_database.pyc
? tests/regress/QMTest/selftest.pyc
? tests/regress/tuple1/QMTest/tuple_test.pyc
? tests/results_files/QMTest/results_file_database.pyc
? tests/results_files/QMTest/results_file_test.pyc
Index: ChangeLog
===================================================================
RCS file: /home/qm/Repository/qm/ChangeLog,v
retrieving revision 1.616
diff -u -r1.616 ChangeLog
--- ChangeLog 31 Mar 2004 10:32:44 -0000 1.616
+++ ChangeLog 29 Apr 2004 01:29:44 -0000
@@ -1,3 +1,9 @@
+2004-04-28 Nathaniel Smith <njs at codesourcery.com>
+
+ * qm/test/cmdline.py (QMTest.GetTargets): Change default target
+ for concurrent test execution to use processes rather than
+ threads.
+
2004-03-30 Nathaniel Smith <njs at codesourcery.com>
* qm/common.py (htmllib): Import it.
Index: qm/test/cmdline.py
===================================================================
RCS file: /home/qm/Repository/qm/qm/test/cmdline.py,v
retrieving revision 1.103
diff -u -r1.103 cmdline.py
--- qm/test/cmdline.py 19 Jan 2004 07:55:52 -0000 1.103
+++ qm/test/cmdline.py 29 Apr 2004 01:29:44 -0000
@@ -735,8 +735,8 @@
arguments["name"] = "local"
arguments["group"] = "local"
if concurrency > 1:
- class_name = "thread_target.ThreadTarget"
- arguments["threads"] = concurrency
+ class_name = "process_target.ProcessTarget"
+ arguments["processes"] = concurrency
else:
class_name = "serial_target.SerialTarget"
target_class \
More information about the qmtest
mailing list