[Python-checkins] bpo-37531: regrtest main process uses shorter timeout (GH-16220) (GH-16223)

Victor Stinner webhook-mailer at python.org
Tue Sep 17 08:34:19 EDT 2019


https://github.com/python/cpython/commit/6591b4bbb1c0b9c26b99e4b2dba1e5cc8546732d
commit: 6591b4bbb1c0b9c26b99e4b2dba1e5cc8546732d
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019年09月17日T14:34:03+02:00
summary:
bpo-37531: regrtest main process uses shorter timeout (GH-16220) (GH-16223)
When using multiprocesss (-jN), the main process now uses a timeout
of 60 seconds instead of the double of the --timeout value. The
buildbot server stops a job which does not produce any output in 1200
seconds.
(cherry picked from commit 46b0b81220a23bc4aee5ba3ba67e8cf1b5df7960)
Co-authored-by: Victor Stinner <vstinner at redhat.com>
files:
M Lib/test/libregrtest/runtest_mp.py
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
index c22479b7976f..482bb80726dc 100644
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -20,6 +20,7 @@
 
 # Display the running tests if nothing happened last N seconds
 PROGRESS_UPDATE = 30.0 # seconds
+assert PROGRESS_UPDATE >= PROGRESS_MIN_TIME
 
 # Time to wait until a worker completes: should be immediate
 JOIN_TIMEOUT = 30.0 # seconds
@@ -305,10 +306,8 @@ def __init__(self, regrtest):
 self.pending = MultiprocessIterator(self.regrtest.tests)
 if self.ns.timeout is not None:
 self.worker_timeout = self.ns.timeout * 1.5
- self.main_timeout = self.ns.timeout * 2.0
 else:
 self.worker_timeout = None
- self.main_timeout = None
 self.workers = None
 
 def start_workers(self):
@@ -345,12 +344,13 @@ def _get_result(self):
 except queue.Empty:
 return None
 
+ use_faulthandler = (self.ns.timeout is not None)
+ timeout = PROGRESS_UPDATE
 while True:
- if self.main_timeout is not None:
- faulthandler.dump_traceback_later(self.main_timeout, exit=True)
+ if use_faulthandler:
+ faulthandler.dump_traceback_later(timeout * 2.0, exit=True)
 
 # wait for a thread
- timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME)
 try:
 return self.output.get(timeout=timeout)
 except queue.Empty:
@@ -415,7 +415,7 @@ def run_tests(self):
 print()
 self.regrtest.interrupted = True
 finally:
- if self.main_timeout is not None:
+ if self.ns.timeout is not None:
 faulthandler.cancel_dump_traceback_later()
 
 # a test failed (and --failfast is set) or all tests completed


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /