[V1] Exception Handling when Loading KV Cache from Remote Store (#21534)

Signed-off-by: liuyumoye <adeline_ly2023@outlook.com>
Co-authored-by: liuyumoye <adeline_ly2023@outlook.com>
This commit is contained in:
Adeline
2025-07-27 20:34:17 -07:00
committed by GitHub
co-authored by liuyumoye
parent 04ff4be310
commit 15a72ac478
10 changed files with 229 additions and 5 deletions
@@ -139,13 +139,27 @@ class KVOutputAggregator:
finished_set.add(req_id)
del remaining_count_dict[req_id]
def update_finished_load_dict(worker_finished_loading_dict: dict[str,
int],
finished_loading_dict: dict[str, int]):
for req_id, num_actual_load_tokens in (worker_finished_loading_dict
or {}).items():
if req_id in finished_loading_dict:
finished_loading_dict[req_id] = min(
finished_loading_dict[req_id], num_actual_load_tokens)
else:
finished_loading_dict[req_id] = num_actual_load_tokens
finished_sending = set[str]()
finished_recving = set[str]()
finished_loading_dict: dict[str, int] = {}
for output in outputs:
update_finished_set(output.finished_sending,
self._send_remaining_count, finished_sending)
update_finished_set(output.finished_recving,
self._recv_remaining_count, finished_recving)
update_finished_load_dict(output.finished_loading_dict,
finished_loading_dict)
# select output of the worker specified by output_rank
output = outputs[output_rank]
@@ -157,7 +171,7 @@ class KVOutputAggregator:
# send/recv
output.finished_sending = finished_sending if finished_sending else None
output.finished_recving = finished_recving if finished_recving else None
output.finished_loading_dict = finished_loading_dict or None
return output
def async_aggregate(self,