Skip to content

Dummy

swerex.deployment.dummy.DummyDeployment

DummyDeployment(*, logger: Logger | None = None, **kwargs: Any)

Bases: AbstractDeployment

This deployment returns blank or predefined outputs. Useful for testing.

Parameters:

Name Type Description Default
**kwargs Any

Keyword arguments (see DummyDeploymentConfig for details).

{}
Source code in swerex/deployment/dummy.py
15
16
17
18
19
20
21
22
23
24
25
def __init__(self, *, logger: logging.Logger | None = None, **kwargs: Any):
    """This deployment returns blank or predefined outputs.
    Useful for testing.

    Args:
        **kwargs: Keyword arguments (see `DummyDeploymentConfig` for details).
    """
    self._config = DummyDeploymentConfig(**kwargs)
    self.logger = logger or get_logger("rex-deploy")
    self._runtime = DummyRuntime(logger=self.logger)  # type: ignore
    self._hooks = CombinedDeploymentHook()

logger instance-attribute

logger = logger or get_logger('rex-deploy')

runtime property writable

runtime: DummyRuntime

add_hook

add_hook(hook: DeploymentHook)
Source code in swerex/deployment/dummy.py
27
28
def add_hook(self, hook: DeploymentHook):
    self._hooks.add_hook(hook)

from_config classmethod

from_config(config: DummyDeploymentConfig) -> Self
Source code in swerex/deployment/dummy.py
30
31
32
@classmethod
def from_config(cls, config: DummyDeploymentConfig) -> Self:
    return cls(**config.model_dump())

is_alive async

is_alive(*, timeout: float | None = None) -> IsAliveResponse
Source code in swerex/deployment/dummy.py
34
35
async def is_alive(self, *, timeout: float | None = None) -> IsAliveResponse:
    return IsAliveResponse(is_alive=True)

start async

start()
Source code in swerex/deployment/dummy.py
37
38
async def start(self):
    pass

stop async

stop()
Source code in swerex/deployment/dummy.py
40
41
async def stop(self):
    pass