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 5021482 commit 3424ec6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


===================
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 3424ec6

Please sign in to comment.