Files
OpenHands/opendevin/runtime/builder/base.py
Xingyao Wang b6243bb96b feat: refactor image building logic into runtime builder (#3395)
* feat: refactor building logic into runtime builder

* return image name

* fix testcases

* use runtime builder for eventstream runtime
2024-08-14 20:02:12 +00:00

38 lines
894 B
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 of the runtime image (e.g., "repo:sha").
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