Skip to content

Commit c055be1

Browse files
author
Sharon Yu
committed
merge luke new commit
1 parent caf49a4 commit c055be1

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

pathwaysutils/elastic/manager.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class NewSliceAvailableError(RuntimeError):
4343
_F = TypeVar("_F", bound=Callable[..., Any])
4444

4545

46-
def _elastic_event_cleanup() -> None:
46+
def _elastic_event_cleanup():
4747
"""Cleans up JAX profiles, caches, and live arrays."""
4848
try:
4949
_logger.info("Cleaning up any ongoing traces")
@@ -149,23 +149,11 @@ def _elasticity_retry_decorator(
149149
pre_callback: Callable[..., Any] | None = None,
150150
on_elastic_event_callback: Callable[..., Any] | None = None,
151151
) -> Callable[[_F], _F]:
152-
"""Retries a function with elasticity fault tolerance.
152+
"""Retries a function with elasticity fault tolerance."""
153153

154-
Args:
155-
max_retries: The maximum number of times to retry the function.
156-
pre_callback: A callback to call before each attempt of the wrapped
157-
function.
158-
on_elastic_event_callback: A callback to call after an elastic failure
159-
occurs.
160-
161-
Returns:
162-
A function decorator.
163-
"""
164-
if max_retries <= 0:
165-
raise ValueError("max_retries must be positive.")
166-
def decorator(func: _F) -> _F:
154+
def decorator(func):
167155
@functools.wraps(func)
168-
def wrapper(*args: Any, **kwargs: Any) -> Any:
156+
def wrapper(*args, **kwargs):
169157
for retry_index in range(max_retries):
170158
try:
171159
_logger.info(
@@ -202,10 +190,6 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
202190
)
203191

204192
return wrapper
205-
else:
206-
raise ElasticRuntimeError(
207-
f"Elastic attempt {max_retries} out of {max_retries} failed."
208-
)
209193

210194
return decorator
211195

0 commit comments

Comments
 (0)