mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* feat: refactor building logic into runtime builder * return image name * fix testcases * use runtime builder for eventstream runtime * have runtime builder return str * add api_key to sandbox config * draft remote runtime * remove extra if clause * initialize runtime based on box class * add build logic * use base64 for file upload * get runtime image prefix from API * replace ___ with _s_ to make it a valid image name * use /build to start build and /build_status to check the build progress * update logging * fix exit code * always use port * add remote runtime * rename runtime * fix tests import * make dir first if work_dir does not exists; * update debug print to remote runtime * fix exit close_sync * update logging * add retry for stop * use all box class for test keep prompt * fix test browsing * add retry stop * merge init commands to save startup time * fix await * remove sandbox url * support execute through specific runtime url * fix file ops * simplify close * factor out runtime retry code * fix exception handling * fix content type error (e.g., bad gateway when runtime is not ready) * add retry for wait until alive; add retry for check image exists * Revert "add retry for wait until alive;" This reverts commit dd013cd2681a159cd07747497d8c95e145d01c32. * retry when wait until alive * clean up msg * directly save sdist to temp dir for _put_source_code_to_dir * support running testcases in parallel * tweak logging; try to close session * try to close session even on exception * update poetry lock * support remote to run integration tests * add warning for workspace base on remote runtime * set default runtime api * remove server runtime * update poetry lock * support running swe-bench (n=1) eval on remoteruntime * add a timeout of 30 min * add todo for docker namespace * update poetry loc
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import abc
|
|
|
|
|
|
class RuntimeBuilder(abc.ABC):
|
|
@abc.abstractmethod
|
|
def build(
|
|
self,
|
|
path: str,
|
|
tags: list[str],
|
|
) -> str:
|
|
"""
|
|
Build the runtime image.
|
|
|
|
Args:
|
|
path (str): The path to the runtime image's build directory.
|
|
tags (list[str]): The tags to apply to the runtime image (e.g., ["repo:my-repo", "sha:my-sha"]).
|
|
|
|
Returns:
|
|
str: The name:tag of the runtime image after build (e.g., "repo:sha").
|
|
This can be different from the tags input if the builder chooses to mutate the tags (e.g., adding a
|
|
registry prefix). This should be used for subsequent use (e.g., `docker run`).
|
|
|
|
Raises:
|
|
RuntimeError: If the build failed.
|
|
"""
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def image_exists(self, image_name: str) -> bool:
|
|
"""
|
|
Check if the runtime image exists.
|
|
|
|
Args:
|
|
image_name (str): The name of the runtime image (e.g., "repo:sha").
|
|
|
|
Returns:
|
|
bool: Whether the runtime image exists.
|
|
"""
|
|
pass
|