Use threading.TIMEOUT_MAX when available (#32399)
This value was introduced in Python 3.2. Specifying a timeout greater than this value will raise an OverflowError.
This commit is contained in:
parent
59bfa6bcd3
commit
ad95719a1d
9
lib/spack/external/ctest_log_parser.py
vendored
9
lib/spack/external/ctest_log_parser.py
vendored
@ -71,6 +71,8 @@
|
|||||||
import re
|
import re
|
||||||
import math
|
import math
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import sys
|
||||||
|
import threading
|
||||||
import time
|
import time
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
|
||||||
@ -409,7 +411,12 @@ def parse(self, stream, context=6, jobs=None):
|
|||||||
pool = multiprocessing.Pool(jobs)
|
pool = multiprocessing.Pool(jobs)
|
||||||
try:
|
try:
|
||||||
# this is a workaround for a Python bug in Pool with ctrl-C
|
# this is a workaround for a Python bug in Pool with ctrl-C
|
||||||
results = pool.map_async(_parse_unpack, args, 1).get(9999999)
|
if sys.version_info >= (3, 2):
|
||||||
|
max_timeout = threading.TIMEOUT_MAX
|
||||||
|
else:
|
||||||
|
max_timeout = 9999999
|
||||||
|
results = pool.map_async(_parse_unpack, args, 1).get(max_timeout)
|
||||||
|
|
||||||
errors, warnings, timings = zip(*results)
|
errors, warnings, timings = zip(*results)
|
||||||
finally:
|
finally:
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
|
Loading…
Reference in New Issue
Block a user