From 3424ec67f3b1a800ccf0a768d8ecef7c92ceb86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gregor=20Jer=C5=A1e?= Date: Mon, 18 Nov 2024 10:29:27 +0100 Subject: [PATCH] Make processing script Python 3.12 compatible --- docs/CHANGELOG.rst | 3 +++ resolwe/flow/executors/startup_processing_container.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 438614385..a7e446ac9 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -14,6 +14,9 @@ Added ----- - Expose ``status`` on ``collection`` and ``entity`` viewset and allow filtering and sorting by it +Changed +------- +- Make processing container startup script ``Python`` 3.12 compatible =================== diff --git a/resolwe/flow/executors/startup_processing_container.py b/resolwe/flow/executors/startup_processing_container.py index 2fe941911..bcc073256 100644 --- a/resolwe/flow/executors/startup_processing_container.py +++ b/resolwe/flow/executors/startup_processing_container.py @@ -485,8 +485,12 @@ async def run(self) -> int: :raises RuntimeError: in case of failure. """ try: + loop = asyncio.get_event_loop() await asyncio.wait( - [self.protocol_handler.script_started.wait(), self._terminating.wait()], + [ + loop.create_task(self.protocol_handler.script_started.wait()), + loop.create_task(self._terminating.wait()), + ], timeout=SCRIPT_START_TIMEOUT, return_when=asyncio.FIRST_COMPLETED, ) @@ -499,10 +503,10 @@ async def run(self) -> int: ) else: monitored_tasks = ( - self.script_server.wait_closed(), + loop.create_task(self.script_server.wait_closed()), self.upload_handler.upload_task, self.communicator_task, - self._terminating.wait(), + loop.create_task(self._terminating.wait()), ) # Stop processing when any of the following tasks complete. await asyncio.wait(monitored_tasks, return_when=asyncio.FIRST_COMPLETED)