Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions databricks/sdk/common/lro.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def __init__(self, *, timeout: Optional[timedelta] = None):
"""
Args:
timeout: The timeout for the Long Running Operations.
If not set, the default timeout is 20 minutes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update this instead with what happens when a timeout is not provided?
Eg: If not set, then operations do not time out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense.

if not set, then operation will wait forever.
"""
self.timeout = timeout or timedelta(minutes=20)
self.timeout = timeout
6 changes: 3 additions & 3 deletions databricks/sdk/retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _backoff(attempt: int) -> float:

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

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

Expand Down
Loading