vllm.entrypoints.launchers.grpc_server
¶
vLLM gRPC Server
Starts a gRPC server backed by AsyncLLM, using the VllmEngineServicer from the smg-grpc-servicer package.
Usage
python -m vllm.entrypoints.launchers.grpc_server --model
Example
python -m vllm.entrypoints.launchers.grpc_server --model meta-llama/Llama-2-7b-hf --host 0.0.0.0 --port 50051
Functions:
-
main–Main entry point for python -m vllm.entrypoints.launchers.grpc_server.
-
serve_grpc–Main gRPC serving function.
_InflightRpcs
¶
Bases: ServerInterceptor
Counts the in-flight RPCs of one service, except subscriptions.
An RPC counts from the moment the server dispatches it, before its request message is received, so one whose request is still arriving or being preprocessed (tokenization, media fetch and processing), and is not yet known to AsyncLLM, counts too. It stops counting when the RPC's task finishes, whether or not its handler ran.
_drain_and_stop(server, async_llm, shutdown_timeout, inflight)
async
¶
Stop the gRPC server and AsyncLLM within --shutdown-timeout.
0 keeps the abort behavior: in-flight RPCs get _RPC_GRACE_S, then
EngineCore gets its default join. Otherwise the server refuses new RPCs at
once and EngineCore keeps serving until the in-flight RPCs (inflight)
and their requests are done; RPCs still running at the deadline
(--shutdown-timeout, but no less than _RPC_GRACE_S) are cancelled
and abort their requests. EngineCore then drains work that outlives an
RPC, such as NIXL prefill blocks the decode side has not read yet, until
the same deadline plus _ENGINE_TEARDOWN_S for teardown.
_wait_for_requests(rpcs, async_llm, inflight)
async
¶
Return once rpcs is done or nothing can still send EngineCore a request.
EngineCore rejects every request it reads once its shutdown has started, even one an RPC forwarded before SIGTERM, so it must keep running while an RPC other than a subscription is in flight or AsyncLLM still has a request. Idle has to hold on two polls in a row, which covers an RPC that gRPC accepted before SIGTERM but has not yet handed to its task.
main()
¶
Main entry point for python -m vllm.entrypoints.launchers.grpc_server.