1010from databricks .labs .ucx .framework .tasks import task , trigger
1111from databricks .labs .ucx .hive_metastore import GrantsCrawler , TablesCrawler
1212from databricks .labs .ucx .hive_metastore .data_objects import ExternalLocationCrawler
13- from databricks .labs .ucx .hive_metastore .list_mounts import Mounts
13+ from databricks .labs .ucx .hive_metastore .mounts import Mounts
1414from databricks .labs .ucx .workspace_access import GroupMigrationToolkit
1515
1616logger = logging .getLogger (__name__ )
@@ -55,7 +55,7 @@ def crawl_grants(cfg: MigrationConfig):
5555
5656
5757@task ("assessment" , depends_on = [setup_schema ])
58- def inventorize_mounts (cfg : MigrationConfig ):
58+ def crawl_mounts (cfg : MigrationConfig ):
5959 """In this segment of the assessment, we will define the scope of the mount points intended for migration into the
6060 Unity Catalog. As these objects are not compatible with the Unity Catalog paradigm, a key component of the
6161 migration process involves transferring them to Unity Catalog External Locations.
@@ -68,8 +68,8 @@ def inventorize_mounts(cfg: MigrationConfig):
6868 mounts .inventorize_mounts ()
6969
7070
71- @task ("assessment" , depends_on = [inventorize_mounts , crawl_tables ])
72- def inventorize_external_locations (cfg : MigrationConfig ):
71+ @task ("assessment" , depends_on = [crawl_mounts , crawl_tables ])
72+ def guess_external_locations (cfg : MigrationConfig ):
7373 """In this section of the assessment, our objective is to determine the whereabouts of all the tables.
7474 Specifically, we will focus on identifying locations that utilize Mount Points. Our goal is to identify the
7575 External Locations necessary for a successful migration and store this information in the
@@ -86,11 +86,11 @@ def inventorize_external_locations(cfg: MigrationConfig):
8686
8787
8888@task ("assessment" , depends_on = [setup_schema ])
89- def inventorize_jobs (cfg : MigrationConfig ):
89+ def assess_jobs (cfg : MigrationConfig ):
9090 """This module scans through all the jobs and identifies those that are not compatible with UC.
9191 It looks for:
9292 - Clusters with DBR version earlier than 11.3
93- - Clusters using Passthru Authentication
93+ - Clusters using Passthrough Authentication
9494 - Clusters with incompatible spark config tags
9595 - Clusters referencing DBFS locations in one or more config options
9696 Subsequently, the list of all the jobs is stored in the `$inventory.jobs` table."""
@@ -100,11 +100,11 @@ def inventorize_jobs(cfg: MigrationConfig):
100100
101101
102102@task ("assessment" , depends_on = [setup_schema ])
103- def inventorize_clusters (cfg : MigrationConfig ):
103+ def assess_clusters (cfg : MigrationConfig ):
104104 """This module scan through all the clusters and identifies those that are not compatible with UC.
105105 It looks for:
106106 - Clusters with DBR version earlier than 11.3
107- - Clusters using Passthru Authentication
107+ - Clusters using Passthrough Authentication
108108 - Clusters with incompatible spark config tags
109109 - Clusters referencing DBFS locations in one or more config options
110110 Subsequently, the list of all the clusters is stored in the`$inventory.clusters` table."""
@@ -114,7 +114,7 @@ def inventorize_clusters(cfg: MigrationConfig):
114114
115115
116116@task ("assessment" , depends_on = [setup_schema ])
117- def inventorize_permissions (cfg : MigrationConfig ):
117+ def crawl_permissions (cfg : MigrationConfig ):
118118 """As we commence the intricate migration process from Hive Metastore to the Databricks Unity Catalog, a critical
119119 element of this transition is the thorough examination and preservation of permissions linked to a wide array of
120120 Databricks Workspace components. These components encompass a broad spectrum of resources, including clusters,
@@ -128,12 +128,15 @@ def inventorize_permissions(cfg: MigrationConfig):
128128 meticulous scan are methodically stored within the `$inventory.permissions` table, which serves as a central
129129 repository for preserving and managing these crucial access control details."""
130130 toolkit = GroupMigrationToolkit (cfg )
131- toolkit .prepare_environment ()
132131 toolkit .cleanup_inventory_table ()
133132 toolkit .inventorize_permissions ()
134133
135134
136- @task ("assessment" , depends_on = [crawl_tables , crawl_grants , inventorize_permissions ], dashboard = "assessment" )
135+ @task (
136+ "assessment" ,
137+ depends_on = [crawl_grants , crawl_permissions , guess_external_locations , assess_jobs , assess_clusters ],
138+ dashboard = "assessment" ,
139+ )
137140def assessment_report (_ : MigrationConfig ):
138141 """This meticulously prepared report serves the purpose of evaluating and gauging the preparedness of a specific
139142 workspace for a smooth transition to the Unity Catalog.
@@ -155,7 +158,7 @@ def assessment_report(_: MigrationConfig):
155158 way for a new era of excellence in data management."""
156159
157160
158- @task ("migrate-groups" , depends_on = [inventorize_permissions ])
161+ @task ("migrate-groups" , depends_on = [crawl_permissions ])
159162def migrate_permissions (cfg : MigrationConfig ):
160163 """As we embark on the complex journey of migrating from Hive Metastore to the Databricks Unity Catalog,
161164 a crucial phase in this transition involves the careful management of permissions.
@@ -193,6 +196,12 @@ def delete_backup_groups(cfg: MigrationConfig):
193196 toolkit .delete_backup_groups ()
194197
195198
199+ @task ("destroy-schema" )
200+ def destroy_schema (cfg : MigrationConfig ):
201+ """Removes the `$inventory` database"""
202+ RuntimeBackend ().execute (f"DROP DATABASE { cfg .inventory_database } CASCADE" )
203+
204+
196205def main ():
197206 trigger (* sys .argv )
198207
0 commit comments