chore: Use lazy % formatting in logging functions to fix pylint warnings

PiperOrigin-RevId: 802639682
This commit is contained in:
Xiang (Sean) Zhou
2025-09-03 11:35:49 -07:00
committed by Copybara-Service
parent 66cc98801a
commit b4310727d9
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -329,7 +329,7 @@ async def run_evals(
except Exception:
# Catching the general exception, so that we don't block other eval
# cases.
logger.exception(f"Eval failed for `{eval_set_id}:{eval_name}`")
logger.exception("Eval failed for `%s:%s`", eval_set_id, eval_name)
def _get_evaluator(eval_metric: EvalMetric) -> Evaluator:
@@ -210,11 +210,11 @@ class BaseLlmFlow(ABC):
except (ConnectionClosed, ConnectionClosedOK) as e:
# when the session timeout, it will just close and not throw exception.
# so this is for bad cases
logger.error(f'Connection closed: {e}.')
logger.error('Connection closed: %s.', e)
raise
except Exception as e:
logger.error(
f'An unexpected error occurred in live flow: {e}', exc_info=True
'An unexpected error occurred in live flow: %s', e, exc_info=True
)
raise
@@ -411,7 +411,7 @@ class DatabaseSessionService(BaseSessionService):
# Get the local timezone
local_timezone = get_localzone()
logger.info(f"Local timezone: {local_timezone}")
logger.info("Local timezone: %s", local_timezone)
self.db_engine: Engine = db_engine
self.metadata: MetaData = MetaData()
@@ -130,7 +130,7 @@ class VertexAiSessionService(BaseSessionService):
reasoning_engine_id, session_id, api_client
)
except ClientError:
logger.info(f'Polling session resource')
logger.info('Polling session resource')
return None
try:
@@ -320,7 +320,7 @@ class VertexAiSessionService(BaseSessionService):
request_dict={},
)
except Exception as e:
logger.error(f'Error deleting session {session_id}: {e}')
logger.error('Error deleting session %s: %s', session_id, e)
raise e
@override