Skip to content

Commit

Permalink
linter and pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
nancyhung committed Oct 30, 2024
1 parent b74a761 commit 3d308f8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions composer/utils/object_store/mlflow_object_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ def _wrap_mlflow_exceptions(uri: str, e: Exception):
not_found_codes = [ErrorCode.Name(code) for code in [RESOURCE_DOES_NOT_EXIST, NOT_FOUND, ENDPOINT_NOT_FOUND]]

# MLflow wraps Azure data exceptions as INTERNAL_ERROR. Need to unwrap and check msg for the specific error.
non_retryable_internal_error_codes = [
permission_error_codes = [
'401',
'403',
]

if isinstance(e, MlflowException):
error_code = e.error_code # pyright: ignore
if error_code == ErrorCode.Name(INTERNAL_ERROR):
error_message = e.message # pyright: ignore
if any(f'{code} Client Error' in error_message for code in non_retryable_internal_error_codes):
raise PermissionError(f'Permission denied for object {uri} from the data provider. Details: {error_message}') from e
error_message = e.message # pyright: ignore
if any(f'{code} Client Error' in error_message for code in permission_error_codes):
raise PermissionError(
f'Permission denied for object {uri} from the data provider. Details: {error_message}',
) from e
elif error_code in retryable_server_codes or error_code in retryable_client_codes:
raise ObjectStoreTransientError(error_code) from e
elif error_code in not_found_codes:
Expand Down

0 comments on commit 3d308f8

Please sign in to comment.