Skip to content

[BUG]: Capture and log the TimeoutError when inventorize_permissions #2078

@qziyuan

Description

@qziyuan

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Certain errors like TimeoutError do not have error_code and it will trigger below AttributeError

AttributeError: 'TimeoutError' object has no attribute 'error_code'
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~/.ipykernel/1242/command--1-163448718:18
     15 entry = [ep for ep in metadata.distribution("databricks_labs_ucx").entry_points if ep.name == "runtime"]
     16 if entry:
     17   # Load and execute the entrypoint, assumes no parameters
---> 18   entry[0].load()()
     19 else:
     20   import importlib

File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/databricks/labs/ucx/runtime.py:103, in main(*argv)
    101 if len(argv) == 0:
    102     argv = sys.argv
--> 103 Workflows.all().trigger(*argv)

File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/databricks/labs/ucx/runtime.py:96, in Workflows.trigger(self, *argv)
     94 ucx_logger.info(f"UCX v{__version__} After job finishes, see debug logs at {task_logger}")
     95 current_task = getattr(workflow, task_name)
---> 96 current_task(ctx)
     97 return None

File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/databricks/labs/ucx/assessment/workflows.py:172, in Assessment.crawl_permissions(self, ctx)
    170 permission_manager = ctx.permission_manager
    171 permission_manager.cleanup()
--> 172 permission_manager.inventorize_permissions()

File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/databricks/labs/ucx/workspace_access/manager.py:35, in PermissionManager.inventorize_permissions(self)
     33 acute_errors = []
     34 for error in errors:
---> 35     if error.error_code not in self.ERRORS_TO_IGNORE:
     36         logger.error(f"Error while crawling permissions: {error}")
     37         acute_errors.append(error)

AttributeError: 'TimeoutError' object has no attribute 'error_code'

Expected Behavior

We should handle the TimeoutError here, so the error can be properly logged

Steps To Reproduce

No response

Cloud

AWS

Operating System

macOS

Version

latest via Databricks CLI

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions