Skip to content

Commit

Permalink
Retry GitHub download failures (#3729)
Browse files Browse the repository at this point in the history
* Retry GitHub download failures

* Refactor and add tests

* Fixed linting and added comment

* Fixing unit test assertRaises

Co-authored-by: Kyle Wigley <kyle@fishtownanalytics.com>

* Fixing casing

Co-authored-by: Kyle Wigley <kyle@fishtownanalytics.com>

* Changing to use partial for function calls

Co-authored-by: Kyle Wigley <kyle@fishtownanalytics.com>

automatic commit by git-black, original commits:
  09ea989
  • Loading branch information
leahwicz authored and iknox-fa committed Feb 8, 2022
1 parent 9078c55 commit 59f5535
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/dbt/clients/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def _get(path, registry_base_url=None):


def index(registry_base_url=None):
return _get_with_retries('api/v1/index.json', registry_base_url)
return _get_with_retries("api/v1/index.json", registry_base_url)


index_cached = memoized(index)


def packages(registry_base_url=None):
return _get_with_retries('api/v1/packages.json', registry_base_url)
return _get_with_retries("api/v1/packages.json", registry_base_url)


def package(name, registry_base_url=None):
Expand Down Expand Up @@ -80,7 +80,7 @@ def package(name, registry_base_url=None):


def package_version(name, version, registry_base_url=None):
return _get_with_retries('api/v1/{}/{}.json'.format(name, version), registry_base_url)
return _get_with_retries("api/v1/{}/{}.json".format(name, version), registry_base_url)


def get_available_versions(name):
Expand Down
2 changes: 1 addition & 1 deletion core/dbt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def _connection_exception_retry(fn, max_attempts: int, attempt: int = 0):
time.sleep(1)
_connection_exception_retry(fn, max_attempts, attempt + 1)
else:
raise ConnectionException('External connection exception occurred: ' + str(exc))
raise ConnectionException("External connection exception occurred: " + str(exc))


# This is used to serialize the args in the run_results and in the logs.
Expand Down

0 comments on commit 59f5535

Please sign in to comment.