"platforms/cuda/vscode:/vscode.git/clone" did not exist on "8c693ef797c77f482d0d65a6ae01cb6981c3d825"
Unverified Commit 83345419 authored by Umang Kedia's avatar Umang Kedia Committed by GitHub
Browse files

fix: KeyError in kv_router.py by Initializing active_blocks_dict for New Workers (#1827)


Co-authored-by: default avatarYan Ru Pei <yanrpei@gmail.com>
parent 7ba05754
......@@ -185,6 +185,12 @@ class Router:
This allows the router to account for requests that have been dispatched but
not yet reflected in the polled metrics.
"""
# Initialize if worker_id is not present
if worker_id not in self.active_blocks_dict:
logger.warning(f"New Worker added: {worker_id}")
self.active_blocks_dict[worker_id] = [polled_value, polled_value]
return polled_value
old_value, predictive_value = self.active_blocks_dict[worker_id]
# Check if polled value is different from old value
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment