Skip to content

Commit

Permalink
feat(ingest/rest-emitter): Do not raise error on retry failure to get…
Browse files Browse the repository at this point in the history
… better error messages
  • Loading branch information
asikowitz committed Sep 13, 2023
1 parent e9b4727 commit efe65a4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metadata-ingestion/src/datahub/emitter/rest_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,15 @@ def __init__(
self._retry_max_times = retry_max_times

try:
# Unset raise_on_status to propagate errors:
# https://stackoverflow.com/questions/70189330/determine-status-code-from-python-retry-exception
# Must call `raise_for_status` after making a request, which we do
retry_strategy = Retry(
total=self._retry_max_times,
status_forcelist=self._retry_status_codes,
backoff_factor=2,
allowed_methods=self._retry_methods,
raise_on_status=False,
)
except TypeError:
# Prior to urllib3 1.26, the Retry class used `method_whitelist` instead of `allowed_methods`.
Expand All @@ -133,6 +137,7 @@ def __init__(
status_forcelist=self._retry_status_codes,
backoff_factor=2,
method_whitelist=self._retry_methods,
raise_on_status=False,
)

adapter = HTTPAdapter(
Expand Down

0 comments on commit efe65a4

Please sign in to comment.