mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
fix: build shutdown listener (#4147)
This commit is contained in:
@@ -9,7 +9,7 @@ from openhands.core.logger import openhands_logger as logger
|
||||
from openhands.runtime.builder import RuntimeBuilder
|
||||
from openhands.runtime.utils.request import send_request
|
||||
from openhands.runtime.utils.shutdown_listener import (
|
||||
should_exit,
|
||||
should_continue,
|
||||
sleep_if_should_continue,
|
||||
)
|
||||
|
||||
@@ -60,8 +60,8 @@ class RemoteRuntimeBuilder(RuntimeBuilder):
|
||||
# Poll /build_status until the build is complete
|
||||
start_time = time.time()
|
||||
timeout = 30 * 60 # 20 minutes in seconds
|
||||
while True:
|
||||
if should_exit() or time.time() - start_time > timeout:
|
||||
while should_continue():
|
||||
if time.time() - start_time > timeout:
|
||||
logger.error('Build timed out after 30 minutes')
|
||||
raise RuntimeError('Build timed out after 30 minutes')
|
||||
|
||||
@@ -101,6 +101,8 @@ class RemoteRuntimeBuilder(RuntimeBuilder):
|
||||
# Wait before polling again
|
||||
sleep_if_should_continue(30)
|
||||
|
||||
raise RuntimeError('Build interrupted (likely received SIGTERM or SIGINT).')
|
||||
|
||||
def image_exists(self, image_name: str, pull_from_repo: bool = True) -> bool:
|
||||
"""Checks if an image exists in the remote registry using the /image_exists endpoint."""
|
||||
params = {'image': image_name}
|
||||
|
||||
Reference in New Issue
Block a user