Skip to content

Commit 6b60ebc

Browse files
authored
Explain failures when cluster encounters Py4J error (#3318)
## Changes Added noisy failures when cluster encounters Py4J error instead of swallowing the error with a warning. ### Linked issues Resolves #3271 ### Functionality - [x] handle error correctly ### Tests - [x] manually tested - [x] verified on labs environment (screenshot attached)
1 parent cb03a75 commit 6b60ebc

File tree

1 file changed

+14
-0
lines changed
  • src/databricks/labs/ucx/hive_metastore

1 file changed

+14
-0
lines changed

src/databricks/labs/ucx/hive_metastore/tables.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,27 @@ def _all_databases(self) -> list[str]:
544544
return list(self._iterator(self._external_catalog.listDatabases()))
545545
return self._include_database
546546
except Exception as err: # pylint: disable=broad-exception-caught
547+
if "py4j.security.Py4JSecurityException" in str(err):
548+
logger.error(
549+
"Failed to list databases due to Py4JSecurityException. "
550+
"Update or reinstall UCX to resolve this issue.",
551+
exc_info=True,
552+
)
553+
return []
547554
logger.error(f"failed-table-crawl: listing databases -> catalog : {err}", exc_info=True)
548555
return []
549556

550557
def _list_tables(self, database: str) -> list[str]:
551558
try:
552559
return list(self._iterator(self._external_catalog.listTables(database)))
553560
except Exception as err: # pylint: disable=broad-exception-caught
561+
if "py4j.security.Py4JSecurityException" in str(err):
562+
logger.error(
563+
"Failed to list databases due to Py4JSecurityException. "
564+
"Update or reinstall UCX to resolve this issue.",
565+
exc_info=True,
566+
)
567+
return []
554568
logger.warning(f"failed-table-crawl: listing tables from database -> {database} : {err}", exc_info=True)
555569
return []
556570

0 commit comments

Comments
 (0)