Skip to content

Commit 3f2afc7

Browse files
committed
Handle TimeoutError on pipeline draining
1 parent 145d125 commit 3f2afc7

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • src/dstack/_internal/server/background/pipeline_tasks

src/dstack/_internal/server/background/pipeline_tasks/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ async def drain(self):
124124
raise PipelineError("Cannot drain running pipeline. Call `shutdown()` first.")
125125
results = await asyncio.gather(*self._tasks, return_exceptions=True)
126126
for task, result in zip(self._tasks, results):
127-
if isinstance(result, BaseException) and not isinstance(
128-
result, asyncio.CancelledError
127+
if (
128+
isinstance(result, BaseException)
129+
and not isinstance(result, asyncio.CancelledError)
130+
and not isinstance(
131+
result,
132+
asyncio.TimeoutError, # At least on Python 3.9 a task may raise TimeoutError from CancelledError.
133+
)
129134
):
130135
logger.error(
131136
"Unexpected exception when draining pipeline task %r",

0 commit comments

Comments
 (0)