Skip to content

Commit

Permalink
fix(tableau): retry on InternalServerError 504
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomezvillamor authored Dec 23, 2024
1 parent b6ea974 commit 90dc243
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
SiteItem,
TableauAuth,
)
from tableauserverclient.server.endpoint.exceptions import NonXMLResponseError
from tableauserverclient.server.endpoint.exceptions import (
InternalServerError,
NonXMLResponseError,
)
from urllib3 import Retry

import datahub.emitter.mce_builder as builder
Expand Down Expand Up @@ -1196,6 +1199,22 @@ def get_connection_object_page(
retry_on_auth_error=False,
retries_remaining=retries_remaining - 1,
)

except InternalServerError as ise:

Check warning on line 1203 in metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py

View check run for this annotation

Codecov / codecov/patch

metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py#L1203

Added line #L1203 was not covered by tests
# In some cases Tableau Server returns 504 error, which is a timeout error, so it worths to retry.
if ise.code == 504:
if retries_remaining <= 0:
raise
return self.get_connection_object_page(

Check warning on line 1208 in metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py

View check run for this annotation

Codecov / codecov/patch

metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py#L1205-L1208

Added lines #L1205 - L1208 were not covered by tests
query=query,
connection_type=connection_type,
query_filter=query_filter,
fetch_size=fetch_size,
current_cursor=current_cursor,
retry_on_auth_error=False,
retries_remaining=retries_remaining - 1,
)

except OSError:
# In tableauseverclient 0.26 (which was yanked and released in 0.28 on 2023-10-04),
# the request logic was changed to use threads.
Expand Down

0 comments on commit 90dc243

Please sign in to comment.