Skip to content

Commit 4c221a9

Browse files
📌 switch from using retry to tenacity (#710)
* switch to tenacity * fix import order
1 parent 8fac97c commit 4c221a9

5 files changed

Lines changed: 13 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
[Please read through the Keep a Changelog (~5min)](https://keepachangelog.com/en/1.0.0/).
1111
## [UNRELEASED] - YYYY-MM-DD
1212

13-
# Fixed
13+
## [0.8.9] - 2022-03-06
14+
15+
### Fixed
1416

1517
- 🔨 fix `dbx deploy --no-package` when `--no-rebuild` is not specified
1618
- 🔗 broken links in the docs
1719

20+
### Changed
21+
22+
- 📌 switch from using `retry` to `tenacity`
23+
1824
## [0.8.8] - 2022-02-22
1925

2026
# Fixed

dbx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.8.8"
1+
__version__ = "0.8.9"

dbx/api/client_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import requests
55
from databricks_cli.sdk import ApiClient
6-
from retry import retry
6+
from tenacity import retry, wait_exponential, stop_after_attempt
77

88
from dbx.api.auth import AuthConfigProvider
99

@@ -33,7 +33,7 @@ def get_context_status(self, payload):
3333

3434
# sometimes cluster is already in the status="RUNNING", however it couldn't yet provide execution context
3535
# to make the execute command stable is such situations, we add retry handler.
36-
@retry(tries=10, delay=5, backoff=5)
36+
@retry(wait=wait_exponential(multiplier=1, min=2, max=5), stop=stop_after_attempt(5))
3737
def create_context(self, payload):
3838
result = self.v1_client.perform_query(method="POST", path="/contexts/create", data=payload)
3939
return result

dbx/utils/file_uploader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from typing import Optional, Tuple
55

66
import mlflow
7-
from retry import retry
7+
from tenacity import retry, wait_exponential, stop_after_attempt
88

99
from dbx.api.context import RichExecutionContextClient
1010
from dbx.utils import dbx_echo
@@ -67,7 +67,7 @@ class MlflowFileUploader(AbstractFileUploader):
6767
"""
6868

6969
@staticmethod
70-
@retry(tries=3, delay=1, backoff=0.3)
70+
@retry(wait=wait_exponential(multiplier=1, min=2, max=5), stop=stop_after_attempt(5))
7171
def _upload_file(file_path: Path):
7272
posix_path = PurePosixPath(file_path.as_posix())
7373
parent = str(posix_path.parent) if str(posix_path.parent) != "." else None

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010
INSTALL_REQUIRES = [
1111
# to use Databricks and MLflow APIs
12-
"retry>=0.9.2, <1.0.0",
1312
"requests>=2.24.0, <3.0.0",
1413
"mlflow-skinny>=1.28.0,<3.0.0",
1514
"databricks-cli>=0.17,<0.18",
15+
"tenacity>=8.2.2,<=9.0.0",
1616
# CLI interface
1717
"click>=8.1.0,<9.0.0",
1818
"rich==12.6.0",

0 commit comments

Comments
 (0)