Skip to content

Commit c365716

Browse files
authored
Remove timeout from poll method and LroOptions. (#1104)
## 🥞 Stacked PR Use this [link](https://github.com/databricks/databricks-sdk-py/pull/1104/files) to review incremental changes. - [**stack/change-none-timeout**](#1104) [[Files changed](https://github.com/databricks/databricks-sdk-py/pull/1104/files)] --------- ## What changes are proposed in this pull request? Remove timeout from poll method and LroOptions. This is one of the PRs that removes the timeout from the LRO operation. ## How is this tested? Existing CI. NO_CHANGELOG=true
1 parent 3959cb6 commit c365716

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

databricks/sdk/common/lro.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ def __init__(self, *, timeout: Optional[timedelta] = None):
1212
"""
1313
Args:
1414
timeout: The timeout for the Long Running Operations.
15-
If not set, the default timeout is 20 minutes.
15+
if not set, then operation will wait forever.
1616
"""
17-
self.timeout = timeout or timedelta(minutes=20)
17+
self.timeout = timeout

databricks/sdk/retries.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _backoff(attempt: int) -> float:
103103

104104
def poll(
105105
fn: Callable[[], Tuple[Optional[T], Optional[RetryError]]],
106-
timeout: timedelta = timedelta(minutes=20),
106+
timeout: Optional[timedelta] = None,
107107
clock: Optional[Clock] = None,
108108
) -> T:
109109
"""Poll a function until it succeeds or times out.
@@ -118,7 +118,7 @@ def poll(
118118
Return (None, RetryError.continues("msg")) to continue polling.
119119
Return (None, RetryError.halt(err)) to stop with error.
120120
Return (result, None) on success.
121-
:param timeout: Maximum time to poll (default: 20 minutes)
121+
:param timeout: Maximum time to poll. If None, polls indefinitely.
122122
:param clock: Clock implementation for testing (default: RealClock)
123123
:returns: The result of the successful function call
124124
:raises TimeoutError: If the timeout is reached
@@ -138,7 +138,7 @@ def check_operation():
138138
if clock is None:
139139
clock = RealClock()
140140

141-
deadline = clock.time() + timeout.total_seconds()
141+
deadline = float("inf") if timeout is None else clock.time() + timeout.total_seconds()
142142
attempt = 0
143143
last_err = None
144144

0 commit comments

Comments
 (0)