track the current retry

This commit is contained in:
zachary62 2025-01-25 05:39:44 +00:00
parent 2716cee40e
commit 2725cbdf76
2 changed files with 3 additions and 3 deletions

View File

@ -27,10 +27,10 @@ class Node(BaseNode):
def __init__(self,max_retries=1,wait=0): super().__init__();self.max_retries,self.wait=max_retries,wait
def exec_fallback(self,prep_res,exc): raise exc
def _exec(self,prep_res):
for i in range(self.max_retries):
for self.cur_retry in range(self.max_retries):
try: return self.exec(prep_res)
except Exception as e:
if i==self.max_retries-1: return self.exec_fallback(prep_res,e)
if self.cur_retry==self.max_retries-1: return self.exec_fallback(prep_res,e)
if self.wait>0: time.sleep(self.wait)
class BatchNode(Node):

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="pocketflow",
version="0.0.0",
version="0.0.1",
packages=find_packages(),
author="Zachary Huang",
author_email="zh2408@columbia.edu",