diff --git a/metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py b/metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py index 984cf9357199d..2b7aac2bea1d0 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py +++ b/metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py @@ -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 @@ -1196,6 +1199,24 @@ def get_connection_object_page( retry_on_auth_error=False, retries_remaining=retries_remaining - 1, ) + + except InternalServerError as ise: + # 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 ise + return self.get_connection_object_page( + 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, + ) + else: + raise ise + 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.