MCPcopy
hub / github.com/allenai/open-instruct / wrapper

Function wrapper

open_instruct/utils.py:1316–1329  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

1314 def decorator(func):
1315 @functools.wraps(func)
1316 def wrapper(*args, **kwargs):
1317 attempts = 0
1318 local_delay = delay
1319 while attempts < max_attempts:
1320 try:
1321 return func(*args, **kwargs)
1322 except Exception as e:
1323 attempts += 1
1324 if attempts == max_attempts:
1325 raise e
1326 print(f"Attempt {attempts} failed. Retrying in {local_delay} seconds...")
1327 time.sleep(local_delay)
1328 local_delay *= backoff
1329 return None
1330
1331 return wrapper
1332

Callers

nothing calls this directly

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected