mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
fix(Runtime): Wait for container to start up (#7548)
Co-authored-by: openhands <openhands@all-hands.dev> Co-authored-by: tofarr <tofarr@gmail.com>
This commit is contained in:
parent
a44cdae36e
commit
a0c79f7388
@ -37,6 +37,16 @@ APP_PORT_RANGE_1 = (50000, 54999)
|
||||
APP_PORT_RANGE_2 = (55000, 59999)
|
||||
|
||||
|
||||
def _is_retryable_wait_until_alive_error(exception):
|
||||
if isinstance(exception, tenacity.RetryError):
|
||||
cause = exception.last_attempt.exception()
|
||||
return _is_retryable_wait_until_alive_error(cause)
|
||||
|
||||
return isinstance(
|
||||
exception, (ConnectionError, httpx.NetworkError, httpx.RemoteProtocolError)
|
||||
)
|
||||
|
||||
|
||||
class DockerRuntime(ActionExecutionClient):
|
||||
"""This runtime will subscribe the event stream.
|
||||
|
||||
@ -347,7 +357,7 @@ class DockerRuntime(ActionExecutionClient):
|
||||
|
||||
@tenacity.retry(
|
||||
stop=tenacity.stop_after_delay(120) | stop_if_should_exit(),
|
||||
retry=tenacity.retry_if_exception_type((ConnectionError, httpx.NetworkError)),
|
||||
retry=tenacity.retry_if_exception(_is_retryable_wait_until_alive_error),
|
||||
reraise=True,
|
||||
wait=tenacity.wait_fixed(2),
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user