Merge branch '3.0' into joserfc-migration

This commit is contained in:
Jeremy Grossmann authored and GitHub committed 2024-12-30 15:52:54 +07:00
commit 0be45c7da2
6 files changed
+12 -22

No files matched your search

+3 -3
View File
@@ -267,9 +267,9 @@ class Server:
else:
log.info(f"Compute authentication is enabled with username '{config.Server.compute_username}'")
# we only support Python 3 version >= 3.8
if sys.version_info < (3, 8, 0):
raise SystemExit("Python 3.8 or higher is required")
# we only support Python 3 version >= 3.9
if sys.version_info < (3, 9, 0):
raise SystemExit("Python 3.9 or higher is required")
log.info(
"Running with Python {major}.{minor}.{micro} and has PID {pid}".format(
+4 -12
View File
@@ -97,18 +97,10 @@ async def wait_for_process_termination(process, timeout=10):
:param timeout: Timeout in seconds
"""
if sys.version_info >= (3, 5):
try:
await asyncio.wait_for(process.wait(), timeout=timeout)
except ProcessLookupError:
return
else:
while timeout > 0:
if process.returncode is not None:
return
await asyncio.sleep(0.1)
timeout -= 0.1
raise asyncio.TimeoutError()
try:
await asyncio.wait_for(process.wait(), timeout=timeout)
except ProcessLookupError:
return
async def _check_process(process, termination_callback):
+1 -4
View File
@@ -40,10 +40,7 @@ class Pool:
while len(self._tasks) > 0 or len(pending) > 0:
while len(self._tasks) > 0 and len(pending) < self._concurrency:
task, args, kwargs = self._tasks.pop(0)
if sys.version_info >= (3, 7):
t = asyncio.create_task(task(*args, **kwargs))
else:
t = asyncio.get_event_loop().create_task(task(*args, **kwargs))
t = asyncio.create_task(task(*args, **kwargs))
pending.add(t)
(done, pending) = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
for task in done: