pub struct EngineClient { /* private fields */ }Expand description
A connection to one engine group: every attention-DP rank’s engine.
Dropping the client ends every open stream with
StreamError::ClientClosed.
Implementations§
Source§impl EngineClient
impl EngineClient
Sourcepub async fn connect(config: ClientConfig) -> Result<Self>
pub async fn connect(config: ClientConfig) -> Result<Self>
Bind the frontend sockets and wait until every engine has registered.
See ClientListener to learn the bound address before waiting.
Sourcepub fn engines(&self) -> Vec<EngineInfo>
pub fn engines(&self) -> Vec<EngineInfo>
The engines, in index order, with the configuration each registered.
Sourcepub fn loads(&self) -> Vec<EngineLoad>
pub fn loads(&self) -> Vec<EngineLoad>
Each engine’s latest reported load, in index order.
Sourcepub fn in_flight(&self) -> Vec<usize>
pub fn in_flight(&self) -> Vec<usize>
This client’s unfinished requests per engine, in index order.
Sourcepub async fn generate(
&self,
request: TokenizedGenerateReqInput,
) -> Result<RequestStream>
pub async fn generate( &self, request: TokenizedGenerateReqInput, ) -> Result<RequestStream>
Submit a request and return its output stream.
The request’s rid must be a single string, unique among requests
in flight. Dropping the stream before its last chunk aborts the
request on the engine.
Sourcepub async fn control(
&self,
request: ControlRequest,
) -> Result<Vec<ControlOutput>>
pub async fn control( &self, request: ControlRequest, ) -> Result<Vec<ControlOutput>>
Run a control operation on every engine and return their replies,
one per engine, in arrival order. Operations of one kind run one at
a time; some (a wait pause, a weight load) answer only when done,
so callers bound the wait themselves.