@@ -279,7 +279,7 @@ def pytest_configure(config) -> None:
279279 pass
280280
281281
282- def pytest_sessionfinish (session , exitstatus ):
282+ def _print_experiment_links (session ):
283283 """Print all collected Fireworks experiment links from pytest stash."""
284284 try :
285285 # Late import to avoid circulars; if missing key, skip printing
@@ -291,9 +291,8 @@ def pytest_sessionfinish(session, exitstatus):
291291 except Exception :
292292 EXPERIMENT_LINKS_STASH_KEY = None
293293
294- # Get links from pytest stash using shared key
294+ # Get links from pytest stash
295295 links = []
296-
297296 if EXPERIMENT_LINKS_STASH_KEY is not None and EXPERIMENT_LINKS_STASH_KEY in session .stash :
298297 links = session .stash [EXPERIMENT_LINKS_STASH_KEY ]
299298
@@ -309,6 +308,55 @@ def pytest_sessionfinish(session, exitstatus):
309308 print (f"❌ Experiment { link ['experiment_id' ]} : { link ['job_link' ]} " , file = sys .__stderr__ )
310309
311310 print ("=" * 80 , file = sys .__stderr__ )
311+ return True
312+ return False
313+ except Exception :
314+ return False
315+
316+
317+ def _print_local_ui_results_urls (session ):
318+ """Print all collected evaluation results URLs from pytest stash."""
319+ try :
320+ # Late import to avoid circulars; if missing key, skip printing
321+ RESULTS_URLS_STASH_KEY = None
322+ try :
323+ from .store_results_url import RESULTS_URLS_STASH_KEY as _URL_KEY # type: ignore
324+
325+ RESULTS_URLS_STASH_KEY = _URL_KEY
326+ except Exception :
327+ RESULTS_URLS_STASH_KEY = None
328+
329+ # Get URLs from pytest stash
330+ urls = []
331+ if RESULTS_URLS_STASH_KEY is not None and RESULTS_URLS_STASH_KEY in session .stash :
332+ urls = session .stash [RESULTS_URLS_STASH_KEY ]
333+
334+ if urls :
335+ print ("\n " + "=" * 80 , file = sys .__stderr__ )
336+ print ("📊 LOCAL UI EVALUATION RESULTS" , file = sys .__stderr__ )
337+ print ("=" * 80 , file = sys .__stderr__ )
338+
339+ for url_data in urls :
340+ print (f"📊 Invocation { url_data ['invocation_id' ]} :" , file = sys .__stderr__ )
341+ print (f" 📊 Aggregate scores: { url_data ['pivot_url' ]} " , file = sys .__stderr__ )
342+ print (f" 📋 Trajectories: { url_data ['table_url' ]} " , file = sys .__stderr__ )
343+
344+ print ("=" * 80 , file = sys .__stderr__ )
345+ return True
346+ return False
347+ except Exception :
348+ return False
349+
350+
351+ def pytest_sessionfinish (session , exitstatus ):
352+ """Print all collected Fireworks experiment links and evaluation results URLs from pytest stash."""
353+ try :
354+ # Print experiment links and results URLs separately
355+ links_printed = _print_experiment_links (session )
356+ urls_printed = _print_local_ui_results_urls (session )
357+
358+ # Flush stderr if anything was printed
359+ if links_printed or urls_printed :
312360 err_stream = getattr (sys , "__stderr__" , None )
313361 if err_stream is not None :
314362 try :
0 commit comments