From d15c5a46de3f4065741f1e654f4b61ca8290b00d Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Thu, 15 Aug 2024 18:29:05 -0300 Subject: [PATCH] Include exception traceback in run_with_retry logging --- libs/langgraph/langgraph/pregel/retry.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/langgraph/langgraph/pregel/retry.py b/libs/langgraph/langgraph/pregel/retry.py index b8da098c4..ce5760bbf 100644 --- a/libs/langgraph/langgraph/pregel/retry.py +++ b/libs/langgraph/langgraph/pregel/retry.py @@ -3,6 +3,7 @@ import logging import random import time from typing import Optional +import traceback from langgraph.pregel.types import PregelExecutableTask, RetryPolicy @@ -49,7 +50,9 @@ def run_with_retry( ) # log the retry logger.info( - f"Retrying task {task.name} after {interval:.2f} seconds (attempt {attempts}) after {exc.__class__.__name__} {exc}" + f"Retrying task {task.name} after {interval:.2f} seconds (attempt {attempts}) due to:\n" + f"{exc.__class__.__name__}: {exc}\n" + f"{traceback.format_exc()}" )