From 4b3005245bf807a599e419fd83cea5e0e246c141 Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Wed, 9 Jul 2025 09:04:09 +0000 Subject: [PATCH] fix: show slot_millis_sum warning only when `allow_large_results=False` --- bigframes/session/__init__.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/bigframes/session/__init__.py b/bigframes/session/__init__.py index 9d113743cf..2c9dea2d19 100644 --- a/bigframes/session/__init__.py +++ b/bigframes/session/__init__.py @@ -339,13 +339,15 @@ def bytes_processed_sum(self): @property def slot_millis_sum(self): """The sum of all slot time used by bigquery jobs in this session.""" - msg = bfe.format_message( - "Queries executed with `allow_large_results=False` within the session will not " - "have their slot milliseconds counted in this sum. If you need precise slot " - "milliseconds information, query the `INFORMATION_SCHEMA` tables " - "to get relevant metrics.", - ) - warnings.warn(msg, UserWarning) + if not bigframes.options._allow_large_results: + msg = bfe.format_message( + "Queries executed with `allow_large_results=False` within the session will not " + "have their slot milliseconds counted in this sum. If you need precise slot " + "milliseconds information, query the `INFORMATION_SCHEMA` tables " + "to get relevant metrics.", + ) + warnings.warn(msg, UserWarning) + return self._metrics.slot_millis @property