Skip to content

lablink_allocator_service.providers.protocol

Provider contracts. Behavior-preserving: BrowserSessionTarget is the exact dataclass client_session already returns (re-exported, not redefined) so routes/internal_proxy_auth.py and existing tests are unaffected.

Bases: Protocol

Provider-owned strategy for browser -> client KasmVNC reachability.

Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def make_join_material(self, **kwargs) -> ClientJoinMaterial: ...
Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def prepare_browser_session(self, **kwargs) -> BrowserSessionTarget: ...

Provider-supplied identifier for one client host.

Everything a fresh client needs to bootstrap (SR-F13). Note: client_secret is minted by the registration endpoint, NOT carried here.

Bases: Protocol

Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def destroy_hosts(
    self,
    handles: list[ClientHandle],
    progress_callback: Callable[[int, int], None] | None = None,
) -> DestroyResult: ...

Return (instance_id, public_ip, ssh_key_path) for hostname.

Any component may be None if unavailable (no credentials, not reachable, etc.). Providers that cannot recover hosts should return (None, None, None) — _reboot_vm gates on can_recover_hosts before calling this, so it will only ever be invoked on capable providers.

Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def get_host_access(
    self, hostname: str
) -> tuple[str | None, str | None, str | None]:
    """Return (instance_id, public_ip, ssh_key_path) for *hostname*.

    Any component may be None if unavailable (no credentials, not
    reachable, etc.).  Providers that cannot recover hosts should
    return (None, None, None) — ``_reboot_vm`` gates on
    ``can_recover_hosts`` before calling this, so it will only ever
    be invoked on capable providers.
    """
    ...
Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def list_hosts(self) -> list[ClientHandle]: ...
Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def provision_hosts(
    self,
    count: int,
    spec: dict,
    progress_callback: Callable[[int, int], None] | None = None,
) -> ProvisionResult: ...
Source code in packages/allocator/src/lablink_allocator_service/providers/protocol.py
def recover_hosts(self, handles: list[ClientHandle]) -> bool: ...

Result of provider.destroy_hosts(...).

Result of provider.provision_hosts(...).

Returned by AWSProvider.provision_hosts and consumed by the /api/launch route handler in main.py.

Bases: Exception

Raised by a provider whose structural model does not support a lifecycle operation. For example, ManualProvider cannot ever provision hosts because the operator brings them; raising this signals "never".