Skip to content

Commit 6949dc0

Browse files
markmcshreyankg
authored andcommitted
[V1][Metrics] Fix traceback with preemptions+LoRA (vllm-project#14220)
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
1 parent c02bc39 commit 6949dc0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

vllm/v1/metrics/stats.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def update_from_events(self, req_id: str, events: list["EngineCoreEvent"],
150150
LoRARequestStates.scheduled_request(lora_stats, req_id)
151151
elif event.type == EngineCoreEventType.PREEMPTED:
152152
self.num_preempted_reqs += 1
153+
LoRARequestStates.preempted_request(lora_stats, req_id)
153154

154155
def update_from_finished_request(self, finish_reason: "FinishReason",
155156
num_prompt_tokens: int,
@@ -224,6 +225,13 @@ def scheduled_request(lora_stats: Optional[LoRAStats], request_id: str):
224225
lora_stats.waiting_requests.remove(request_id)
225226
lora_stats.running_requests.add(request_id)
226227

228+
@staticmethod
229+
def preempted_request(lora_stats: Optional[LoRAStats], request_id: str):
230+
if lora_stats is None:
231+
return
232+
lora_stats.running_requests.remove(request_id)
233+
lora_stats.waiting_requests.add(request_id)
234+
227235
def update_iteration_stats(self,
228236
iteration_stats: Optional[IterationStats]):
229237
if iteration_stats is None:

0 commit comments

Comments
 (0)