|
4 | 4 |
|
5 | 5 | from databricks.sdk import WorkspaceClient |
6 | 6 | from databricks.sdk.errors import NotFound |
| 7 | +from databricks.sdk.service import compute |
7 | 8 | from databricks.sdk.service.compute import ClusterDetails, ClusterSource, Policy |
8 | 9 |
|
9 | 10 | from databricks.labs.ucx.assessment.crawlers import ( |
@@ -67,17 +68,21 @@ def _check_init_scripts(self, cluster, failures): |
67 | 68 | continue |
68 | 69 | failures.append(f"{_AZURE_SP_CONF_FAILURE_MSG} cluster.") |
69 | 70 |
|
70 | | - def _check_cluster_failures(self, cluster: ClusterDetails): |
| 71 | + def _check_cluster_failures(self, cluster: ClusterDetails | compute.ClusterSpec): |
71 | 72 | failures = [] |
72 | | - if not cluster.creator_user_name: |
| 73 | + if isinstance(cluster, ClusterDetails) and not cluster.creator_user_name: |
73 | 74 | logger.warning( |
74 | 75 | f"Cluster {cluster.cluster_id} have Unknown creator, it means that the original creator " |
75 | 76 | f"has been deleted and should be re-created" |
76 | 77 | ) |
| 78 | + cluster_id = cluster.cluster_id if isinstance(cluster, ClusterDetails) and cluster.cluster_id else "" |
| 79 | + creator_user_name = ( |
| 80 | + cluster.creator_user_name if isinstance(cluster, ClusterDetails) and cluster.creator_user_name else None |
| 81 | + ) |
77 | 82 | cluster_info = ClusterInfo( |
78 | | - cluster_id=cluster.cluster_id if cluster.cluster_id else "", |
| 83 | + cluster_id=cluster_id, |
79 | 84 | cluster_name=cluster.cluster_name, |
80 | | - creator=cluster.creator_user_name, |
| 85 | + creator=creator_user_name, |
81 | 86 | success=1, |
82 | 87 | failures="[]", |
83 | 88 | ) |
|
0 commit comments