[Core] Cleanup KVConnector handling with PP + fix MRV2 (#43732)

Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Nick Hill
2026-05-28 13:12:03 -07:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 9090368b65
commit 7e53283b1c
9 changed files with 38 additions and 48 deletions
+14
View File
@@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from abc import ABC, abstractmethod
from copy import copy
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, NamedTuple, TypeAlias
@@ -279,6 +280,19 @@ class ModelRunnerOutput:
# ``None`` when ``enable_return_routed_experts`` is off.
routed_experts: RoutedExpertsLists | None = None
@staticmethod
def with_kv_conn_output_only(
kv_connector_output: KVConnectorOutput | None,
) -> "ModelRunnerOutput":
"""Return ModelRunnerOutput containing the provided KVConnectorOutput,
otherwise empty. Returns None if kv_connector_output is passed as None.
"""
if kv_connector_output is None or kv_connector_output.is_empty():
return EMPTY_MODEL_RUNNER_OUTPUT
output = copy(EMPTY_MODEL_RUNNER_OUTPUT)
output.kv_connector_output = kv_connector_output
return output
# ModelRunnerOutput wrapper for async scheduling.
class AsyncModelRunnerOutput(ABC):