Skip to content

Commit 4142320

Browse files
authored
[https://nvbugs/5444937][fix] Fixing kv_cache_event unit test (#6753)
Signed-off-by: Patrice Castonguay <[email protected]>
1 parent 14b36e0 commit 4142320

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tests/unittest/llmapi/test_llm_kv_cache_events.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def check_events(llm,
175175
else:
176176
while events:
177177
event = events.pop(0)
178+
assert "attention_dp_rank" in event
178179
if event and event["attention_dp_rank"] == attention_dp_rank:
179180
assert event["event_id"] in [0, 1]
180181
assert event["data"]["type"] in ["created", "stored"]
@@ -192,8 +193,8 @@ def check_events(llm,
192193

193194
while events2:
194195
event = events2.pop(0)
195-
if event and (event["attention_dp_rank"] == attention_dp_rank
196-
or attention_dp_rank is None):
196+
if event and (attention_dp_rank is None
197+
or event.get("attention_dp_rank") == attention_dp_rank):
197198
if event["event_id"] == 2:
198199
# 2 removed events needed
199200
# should be a removed event to make space for context block
@@ -215,8 +216,8 @@ def check_events(llm,
215216

216217
while events3:
217218
event = events3.pop(0)
218-
if event and (event["attention_dp_rank"] == attention_dp_rank
219-
or attention_dp_rank is None):
219+
if event and (attention_dp_rank is None
220+
or event.get("attention_dp_rank") == attention_dp_rank):
220221
if event["event_id"] == 5:
221222
assert event["data"]["type"] == "removed"
222223
assert event["data"]["block_hashes"]

0 commit comments

Comments
 (0)