Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions fastdeploy/cache_manager/prefix_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def sync_swap_task(self, transfer_task_id):
"""
while True:
flag = self.task_swapping_event[transfer_task_id].wait(timeout=0.1)
if flag or self.prefix_tree_status_signal.value != PrefixTreeStatus.NORMAL:
if flag or self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
if not flag:
logger.info(f"swap task timeout because prefix tree status is not normal: {transfer_task_id}")
break
Expand Down Expand Up @@ -667,7 +667,7 @@ def update_cache_blocks(self, task, block_size, num_computed_tokens):
self.cache_info[req_id] = (leaf_node, can_cache_computed_tokens)
task.cached_block_num = can_cache_computed_tokens // block_size
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"update_cache_blocks: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -790,7 +790,7 @@ def request_match_blocks(self, task, block_size, *args):
task.cached_block_num = len(common_block_ids)
return common_block_ids, matched_token_num, hit_info
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"request_match_blocks: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -900,7 +900,7 @@ def request_block_ids(self, task, block_size, dec_token_num, *args):
)
return common_block_ids, unique_block_ids, hit_info
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"request_block_ids: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -959,7 +959,7 @@ def release_block_ids(self, task):
)
return
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"release_block_ids: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -999,7 +999,7 @@ def free_nodes_directly(self, node):
else:
break
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"free_nodes_directly: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -1196,7 +1196,7 @@ def free_block_ids_async(self, need_block_num):
else:
self.gpu_free_task_future = None
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"free_block_ids_async: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand Down Expand Up @@ -1767,7 +1767,7 @@ def recv_data_transfer_result(self):
+ f"task_cpu_block_id {task_cpu_block_id} event_type {event_type} done"
)
except Exception as e:
if self.prefix_tree_status_signal != PrefixTreeStatus.NORMAL:
if self.prefix_tree_status_signal.value[0] != PrefixTreeStatus.NORMAL:
logger.warning(
f"recv_data_transfer_result: an error occured while prefix tree status is not normal, ignore it. {e}"
)
Expand All @@ -1787,10 +1787,6 @@ def reset(self):
while not self.cache_task_queue.result_queue_empty():
time.sleep(0.1)

# if len(self.node_map) == 0:
# logger.info("node map is empty!")
# return

logger.info(f"Resetting the RadixTree! node_map len {len(self.node_map)}")

logger.info("waiting for cpu_free_future to finish")
Expand Down
Loading