File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- FROM python:3.12 -slim
1+ FROM python:3.13 -slim
22
33LABEL maintainer="pyfuse" \
44 description="pyfuse sandbox guest agent"
Original file line number Diff line number Diff line change 2020import shutil
2121import asyncio
2222import logging
23+ import contextlib
2324from typing import Any
2425from pathlib import Path
2526from collections .abc import Callable
@@ -133,6 +134,11 @@ async def execute(
133134 f"Sandbox execution of '{ function_name } ' timed out "
134135 f"after { self .timeout } s"
135136 ) from None
137+ except (asyncio .IncompleteReadError , ConnectionError , OSError ) as exc :
138+ raise WorkerError (
139+ f"Sandbox connection lost while executing '{ function_name } ': "
140+ f"{ type (exc ).__name__ } : { exc } "
141+ ) from exc
136142
137143 if response ["status" ] == "error" :
138144 raise WorkerError (
@@ -211,6 +217,8 @@ async def _wait_for_agent(self) -> None:
211217 timeout = 2.0 ,
212218 )
213219 _w .close ()
220+ with contextlib .suppress (ConnectionError , OSError ):
221+ await _w .wait_closed ()
214222 return
215223 except (OSError , asyncio .TimeoutError ):
216224 await asyncio .sleep (1 )
You can’t perform that action at this time.
0 commit comments