Skip to content

Commit

Permalink
Make processing script Python 3.12 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Nov 25, 2024
1 parent e20bbb0 commit d2f144c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
9 changes: 9 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ All notable changes to this project are documented in this file.
This project adheres to `Semantic Versioning <http://semver.org/>`_.


==========
Unreleased
==========

Changed
-------
- Make processing container startup script ``Python`` 3.12 compatible


===================
42.0.1 - 2024-11-21
===================
Expand Down
10 changes: 7 additions & 3 deletions resolwe/flow/executors/startup_processing_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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)
Expand Down

0 comments on commit d2f144c

Please sign in to comment.