reserve_slot#

async RunningReplica.reserve_slot(request_metadata: RequestMetadata) → Tuple[str, ReplicaQueueLengthInfo][source]#

Reserve a slot on this replica for an upcoming request.

Returns a unique token that can be used to release the slot later. This is used in the choose_replica/dispatch pattern to track reservations that haven’t been dispatched yet.

Parameters:

request_metadata (RequestMetadata) – Metadata of the request the slot is for.

Returns:

A tuple of the slot token and the replica’s queue length info, which says whether the replica accepted the reservation.

Raises:

RuntimeError – If the replica is a Java replica.

Return type:

Tuple[str, ReplicaQueueLengthInfo]