Skip to content

unienv_interface.remote.client

Synchronous requests with an independent response/event receiver.

Subscription

Subscription(client: RemoteClient, resource_id: str, subscription_id: str)

Closeable latest-snapshot iterator. next(timeout=...) is also supported.

next

next(timeout: Optional[float] = None) -> WireMessage

close

close() -> None

RemoteClient

RemoteClient(transport: MessageTransport, *, backend: ComputeBackend = NumpyComputeBackend, device: Optional[object] = None, timeout: Optional[float] = 30.0, max_message_size: int = DEFAULT_MAX_MESSAGE_SIZE)

A connection, descriptor cache, and shared control session.

Requests are serialized, including entire component operation contexts. A timeout closes the connection: late replies can never be confused with a later request. Mutations aren't retried and may have executed remotely.

timeout instance-attribute

timeout = timeout

codec instance-attribute

codec = Codec(max_message_size)

closed instance-attribute

closed = False

descriptors instance-attribute

descriptors: Dict[str, Descriptor] = {}

session_id instance-attribute

session_id: Optional[str] = hello['session_id']

connect classmethod

connect(uri: str, **options: object) -> RemoteClient

discover

discover() -> List[Descriptor]

describe

describe(resource_id: str) -> Descriptor

resource

resource(resource_id: str) -> Union[RemoteEnv, RemoteWorld, RemoteWorldNode]

env

env(resource_id: str) -> RemoteEnv

world

world(resource_id: str) -> RemoteWorld

node

node(resource_id: str) -> RemoteWorldNode

acquire

acquire(resource_id: str, mode: Optional[ExecutionMode] = None) -> None

release

release(resource_id: str, *, close_subscriptions: bool = False) -> None

Release shared world control, retaining subscriptions by default.

Set close_subscriptions=True to also close this client's domain streams.

operation

operation(resource_id: str, kind: OperationKind = 'step') -> Iterator[str]

Mark one client-coordinated reset/reload/step, without rollback.

Use a world or node ID. Every mutating component call must belong to an operation. The context publishes snapshots only after successful exit.

call

call(resource_id: str, method: str, *args: Any, **kwargs: Any) -> Any

subscribe

subscribe(resource_id: str, fields: Optional[Iterable[str]] = None) -> Subscription

close

close() -> None