BaseProvider
A backend that runs session instances and reports on its host.
Attributes
attributeorphan_gracefloat= READY_TIMEOUT * 2Seconds an unreferenced instance may belong to a launch
still in progress before managed_instances callers remove it.
attributeapp_config= app_config or {'provider_config': {}}Functions
constructor__init__(app_config=None) -> NoneBind the provider to an application.
paramapp_configdict[str, Any] | None= NoneResolved application dictionary (InstalledApp shape)
including provider_config; omitted for host-level calls.
Returns
Nonefunclaunch(session_id, env_vars, volumes=None, gpu_config=None, network=None, is_collaboration=False, master_token=None, initial_tokens=None, vpn=None) -> dict[str, Any]Launch an instance of the application and wait until it answers.
paramsession_idstrUnique id of the session.
paramenv_varsdict[str, str]Environment variables for the instance.
paramvolumesdict[str, Any] | None= NoneServer paths to mount, each to {"bind": <path in the instance>}.
paramgpu_configdict[str, Any] | None= NoneGPU descriptor from state.available_gpus.
paramnetworkstr | None= NoneDocker network to attach the instance to.
paramis_collaborationbool= FalseWhether this is a collaboration session.
parammaster_tokenstr | None= NoneMaster token of the downstream control plane.
paraminitial_tokensdict[str, Any] | None= NoneInitial token set for the downstream control plane.
paramvpndict[str, Any] | None= NoneThe gateway the instance leaves through, as vpn.acquire returns it, or None.
Returns
dict{"instance_id": str, "ip": str, "port": int}.
funcstop(instance_id) -> NoneStop and remove an instance; a missing one is not an error.
paraminstance_idstrReturns
Nonefuncis_running(instance_id) -> boolTell whether an instance still runs.
paraminstance_idstrReturns
boolfuncmanaged_instances() -> dict[str, float]Return the instances this server labelled, with their creation times.
Returns
dict[str, float]funcinspect_self() -> NoneDiscover what the backend needs to know about the server's own container.
Returns
Nonefuncdetect_gpus() -> NoneFill state.available_gpus with the GPUs sessions can request.
Returns
Nonefuncrefresh_gpus() -> NoneBring state.available_gpus up to date before it is offered or used.
Returns
Nonefuncget_local_image_info(image_name) -> dict[str, Any] | NoneReturn {"id", "short_id", "digests"} of the image sessions run, or None.
paramimage_namestrReturns
dict[str, typing.Any] | Nonefuncget_remote_image_digest(image_name) -> str | NoneReturn the digest the registry serves for an image now, or None.
paramimage_namestrReturns
str | Nonefuncpull_image(image_name) -> AnyMake new sessions run the registry's current image.
paramimage_namestrReturns
typing.Anyfuncprune_images() -> NoneRemove images no session can use any more.
Returns
Nonefuncregistry_credentials() -> dict[str, tuple[str, str]]Return the username and password per registry host the backend holds beside the node's file.
Returns
dict[str, tuple[str, str]]funcexport_web_client(image, path) -> bytesReturn path of the image as a tar stream, gzipped or not, from a throwaway instance of it.
The entries may sit under one directory, the exported one, or not.
The instance runs nothing of the image, or tar alone, with no
network and nothing mounted, and is gone when this returns.
paramimagestrThe image reference, as an application names it.
parampathstrThe directory inside the image to export.
Returns
bytesfunc_wait_until_ready(session_id, current_ip, env_vars, is_collaboration=False, master_token=None, initial_tokens=None) -> strPoll the instance's web endpoint until it answers, then seed a room's tokens.
paramsession_idstrSession id for log prefixes.
paramcurrent_ipCallable[[], Awaitable[str | None]]Returns the instance's address, None while it has none;
raises HTTPException when the instance can no longer start.
paramenv_varsdict[str, str]Environment the basic-auth credentials and subfolder come from.
paramis_collaborationbool= FalseAlso post the initial tokens to the control plane.
parammaster_tokenstr | None= NoneControl-plane master token.
paraminitial_tokensdict[str, Any] | None= NoneTokens to post.
Returns
strThe instance's IP address.