Skip to content

Commit f3b4bb0

Browse files
author
Dylan Huang
committed
only print local ui URL once
1 parent e83c5bd commit f3b4bb0

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

eval_protocol/pytest/plugin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,16 +327,16 @@ def _print_local_ui_results_urls(session):
327327
RESULTS_URLS_STASH_KEY = None
328328

329329
# Get URLs from pytest stash
330-
urls = []
330+
urls_dict = {}
331331
if RESULTS_URLS_STASH_KEY is not None and RESULTS_URLS_STASH_KEY in session.stash:
332-
urls = session.stash[RESULTS_URLS_STASH_KEY]
332+
urls_dict = session.stash[RESULTS_URLS_STASH_KEY]
333333

334-
if urls:
334+
if urls_dict:
335335
print("\n" + "=" * 80, file=sys.__stderr__)
336336
print("📊 LOCAL UI EVALUATION RESULTS", file=sys.__stderr__)
337337
print("=" * 80, file=sys.__stderr__)
338338

339-
for url_data in urls:
339+
for url_data in urls_dict.values():
340340
print(f"📊 Invocation {url_data['invocation_id']}:", file=sys.__stderr__)
341341
print(f" 📊 Aggregate scores: {url_data['pivot_url']}", file=sys.__stderr__)
342342
print(f" 📋 Trajectories: {url_data['table_url']}", file=sys.__stderr__)

eval_protocol/pytest/store_results_url.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ResultsUrl(TypedDict):
88
table_url: str
99

1010

11-
RESULTS_URLS_STASH_KEY = StashKey[list[ResultsUrl]]()
11+
RESULTS_URLS_STASH_KEY = StashKey[dict[str, ResultsUrl]]()
1212

1313

1414
def _store_local_ui_url_in_stash(invocation_id: str, pivot_url: str, table_url: str):
@@ -29,11 +29,14 @@ def _store_local_ui_url_in_stash(invocation_id: str, pivot_url: str, table_url:
2929
global RESULTS_URLS_STASH_KEY
3030

3131
if RESULTS_URLS_STASH_KEY not in session.stash: # pyright: ignore[reportAny]
32-
session.stash[RESULTS_URLS_STASH_KEY] = [] # pyright: ignore[reportAny]
33-
34-
session.stash[RESULTS_URLS_STASH_KEY].append( # pyright: ignore[reportAny]
35-
{"invocation_id": invocation_id, "pivot_url": pivot_url, "table_url": table_url}
36-
)
32+
session.stash[RESULTS_URLS_STASH_KEY] = {} # pyright: ignore[reportAny]
33+
34+
# Store by invocation_id as key - automatically handles deduplication
35+
session.stash[RESULTS_URLS_STASH_KEY][invocation_id] = { # pyright: ignore[reportAny]
36+
"invocation_id": invocation_id,
37+
"pivot_url": pivot_url,
38+
"table_url": table_url,
39+
}
3740
else:
3841
pass
3942

0 commit comments

Comments
 (0)