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.
Source code in vllm/entrypoints/launchers/grpc_server.py
_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.
Source code in vllm/entrypoints/launchers/grpc_server.py
_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.
Source code in vllm/entrypoints/launchers/grpc_server.py
main()
¶
Main entry point for python -m vllm.entrypoints.launchers.grpc_server.
Source code in vllm/entrypoints/launchers/grpc_server.py
serve_grpc(args)
async
¶
Main gRPC serving function.
Parameters:
Source code in vllm/entrypoints/launchers/grpc_server.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |