Skip to content

Refactor WorkspaceInstaller using service factory#1480

Merged
nfx merged 10 commits intomainfrom
refactor/workspace_installer
Apr 22, 2024
Merged

Refactor WorkspaceInstaller using service factory#1480
nfx merged 10 commits intomainfrom
refactor/workspace_installer

Conversation

@nkvuong
Copy link
Copy Markdown
Contributor

@nkvuong nkvuong commented Apr 22, 2024

Changes

  • refactor WorkspaceInstaller using service factory.
    • this removes the need for sql_backend_factory and wheel_builder_factory
    • there is no more logic inside of main function in install.py, so we can achieve better test coverage through unit testing
  • remove obsolete reference to WorkspaceInstaller in unit/test_dashboard.py

Linked issues

This follows #1209

Tests

  • manually tested
  • added unit tests
  • verified on staging environment (screenshot attached)

@nkvuong nkvuong requested review from a team and ericvergnaud April 22, 2024 10:10
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 94.64286% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 88.48%. Comparing base (73db677) to head (ab825fa).
Report is 2 commits behind head on main.

Files Patch % Lines
src/databricks/labs/ucx/install.py 94.64% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1480      +/-   ##
==========================================
+ Coverage   88.29%   88.48%   +0.19%     
==========================================
  Files          78       78              
  Lines        9539     9575      +36     
  Branches     1692     1699       +7     
==========================================
+ Hits         8422     8472      +50     
+ Misses        744      728      -16     
- Partials      373      375       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link
Copy Markdown

❌ 140/141 passed, 2 flaky, 1 failed, 24 skipped, 1h22m32s total

❌ test_running_real_remove_backup_groups_job: TimeoutError: Timed out after 0:02:00 (5m27.535s)
TimeoutError: Timed out after 0:02:00
[gw7] linux -- Python 3.10.14 /home/runner/work/ucx/ucx/.venv/bin/python
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added workspace user fixture: User(active=True, display_name='[email protected]', emails=[ComplexValue(display=None, primary=True, ref=None, type='work', value='[email protected]')], entitlements=[], external_id=None, groups=[], id='6603457138622490', name=Name(family_name=None, given_name='[email protected]'), roles=[], schemas=[<UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_USER: 'urn:ietf:params:scim:schemas:core:2.0:User'>, <UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_EXTENSION_WORKSPACE_2_0_USER: 'urn:ietf:params:scim:schemas:extension:workspace:2.0:User'>], user_name='[email protected]')
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Workspace group ucx_us8o: https://DATABRICKS_HOST#setting/accounts/groups/721739124880534
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added workspace group fixture: Group(display_name='ucx_us8o', entitlements=[ComplexValue(display=None, primary=None, ref=None, type=None, value='allow-cluster-create')], external_id=None, groups=[], id='721739124880534', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=ResourceMeta(resource_type='WorkspaceGroup'), roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Account group ucx_us8o: https://accounts.CLOUD_ENVdatabricks.net/users/groups/639056309626039/members
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added account group fixture: Group(display_name='ucx_us8o', entitlements=[], external_id=None, groups=[], id='639056309626039', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=None, roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Schema hive_metastore.ucx_syltc: https://DATABRICKS_HOST/explore/data/hive_metastore/ucx_syltc
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added schema fixture: SchemaInfo(browse_only=None, catalog_name='hive_metastore', catalog_type=None, comment=None, created_at=None, created_by=None, effective_predictive_optimization_flag=None, enable_predictive_optimization=None, full_name='hive_metastore.ucx_syltc', metastore_id=None, name='ucx_syltc', owner=None, properties=None, storage_location=None, storage_root=None, updated_at=None, updated_by=None)
10:29 DEBUG [databricks.labs.ucx.install] Cannot find previous installation: Path (/Users/0a330eb5-dd51-4d97-b6e4-c474356b1d5d/.CYhM/config.yml) doesn't exist.
10:29 INFO [databricks.labs.ucx.install] Please answer a couple of questions to configure Unity Catalog migration
10:29 INFO [databricks.labs.ucx.installer.hms_lineage] HMS Lineage feature creates one system table named system.hms_to_uc_migration.table_access and helps in your migration process from HMS to UC by allowing you to programmatically query HMS lineage data.
10:29 INFO [databricks.labs.ucx.install] Fetching installations...
10:29 INFO [databricks.labs.ucx.installer.policy] Creating UCX cluster policy.
10:29 DEBUG [tests.integration.conftest] Waiting for clusters to start...
10:29 DEBUG [tests.integration.conftest] Waiting for clusters to start...
10:29 INFO [databricks.labs.ucx.install] Installing UCX v0.21.1+10620240422102937
10:29 INFO [databricks.labs.ucx.install] Creating ucx schemas...
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-groups
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=validate-groups-permissions
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-groups-experimental
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=failing
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-tables-in-mounts-experimental
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=assessment
10:30 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-tables
10:30 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=remove-workspace-local-backup-groups
10:30 INFO [databricks.labs.ucx.install] Installation completed successfully! Please refer to the https://DATABRICKS_HOST/#workspace/Users/0a330eb5-dd51-4d97-b6e4-c474356b1d5d/.CYhM/README for the next steps.
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 WARNING [databricks.labs.ucx.workspace_access.groups] Group ucx_us8o defined in configuration does not exist on the groups table. Consider checking if the group exist in the workspace or re-running the assessment.
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] crawling new batch for groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=WorkspaceGroup) with id,displayName,meta,externalId,members,roles,entitlements...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 7 WorkspaceGroup
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing account groups with id,displayName,externalId...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 645 account groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Group listing provided, a subset of all groups will be migrated
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] found 1 new records for groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=Group) with id,displayName,externalId,meta...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 62 Group
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=WorkspaceGroup) with id,displayName,meta,externalId,members,roles,entitlements...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 9 WorkspaceGroup
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Renaming: ucx_us8o -> rename-CYhM-ucx_us8o
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing account groups with id,displayName,externalId...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 646 account groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=Group) with id,displayName,externalId,meta...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 62 Group
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 DEBUG [databricks.labs.ucx.installer.workflows] starting remove-workspace-local-backup-groups job: https://DATABRICKS_HOST#job/723555959892053
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added workspace user fixture: User(active=True, display_name='[email protected]', emails=[ComplexValue(display=None, primary=True, ref=None, type='work', value='[email protected]')], entitlements=[], external_id=None, groups=[], id='6603457138622490', name=Name(family_name=None, given_name='[email protected]'), roles=[], schemas=[<UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_USER: 'urn:ietf:params:scim:schemas:core:2.0:User'>, <UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_EXTENSION_WORKSPACE_2_0_USER: 'urn:ietf:params:scim:schemas:extension:workspace:2.0:User'>], user_name='[email protected]')
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Workspace group ucx_us8o: https://DATABRICKS_HOST#setting/accounts/groups/721739124880534
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added workspace group fixture: Group(display_name='ucx_us8o', entitlements=[ComplexValue(display=None, primary=None, ref=None, type=None, value='allow-cluster-create')], external_id=None, groups=[], id='721739124880534', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=ResourceMeta(resource_type='WorkspaceGroup'), roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Account group ucx_us8o: https://accounts.CLOUD_ENVdatabricks.net/users/groups/639056309626039/members
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added account group fixture: Group(display_name='ucx_us8o', entitlements=[], external_id=None, groups=[], id='639056309626039', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=None, roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:29 INFO [databricks.labs.ucx.mixins.fixtures] Schema hive_metastore.ucx_syltc: https://DATABRICKS_HOST/explore/data/hive_metastore/ucx_syltc
10:29 DEBUG [databricks.labs.ucx.mixins.fixtures] added schema fixture: SchemaInfo(browse_only=None, catalog_name='hive_metastore', catalog_type=None, comment=None, created_at=None, created_by=None, effective_predictive_optimization_flag=None, enable_predictive_optimization=None, full_name='hive_metastore.ucx_syltc', metastore_id=None, name='ucx_syltc', owner=None, properties=None, storage_location=None, storage_root=None, updated_at=None, updated_by=None)
10:29 DEBUG [databricks.labs.ucx.install] Cannot find previous installation: Path (/Users/0a330eb5-dd51-4d97-b6e4-c474356b1d5d/.CYhM/config.yml) doesn't exist.
10:29 INFO [databricks.labs.ucx.install] Please answer a couple of questions to configure Unity Catalog migration
10:29 INFO [databricks.labs.ucx.installer.hms_lineage] HMS Lineage feature creates one system table named system.hms_to_uc_migration.table_access and helps in your migration process from HMS to UC by allowing you to programmatically query HMS lineage data.
10:29 INFO [databricks.labs.ucx.install] Fetching installations...
10:29 INFO [databricks.labs.ucx.installer.policy] Creating UCX cluster policy.
10:29 DEBUG [tests.integration.conftest] Waiting for clusters to start...
10:29 DEBUG [tests.integration.conftest] Waiting for clusters to start...
10:29 INFO [databricks.labs.ucx.install] Installing UCX v0.21.1+10620240422102937
10:29 INFO [databricks.labs.ucx.install] Creating ucx schemas...
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-groups
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=validate-groups-permissions
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-groups-experimental
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=failing
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-tables-in-mounts-experimental
10:29 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=assessment
10:30 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=migrate-tables
10:30 INFO [databricks.labs.ucx.installer.workflows] Creating new job configuration for step=remove-workspace-local-backup-groups
10:30 INFO [databricks.labs.ucx.install] Installation completed successfully! Please refer to the https://DATABRICKS_HOST/#workspace/Users/0a330eb5-dd51-4d97-b6e4-c474356b1d5d/.CYhM/README for the next steps.
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 WARNING [databricks.labs.ucx.workspace_access.groups] Group ucx_us8o defined in configuration does not exist on the groups table. Consider checking if the group exist in the workspace or re-running the assessment.
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] crawling new batch for groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=WorkspaceGroup) with id,displayName,meta,externalId,members,roles,entitlements...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 7 WorkspaceGroup
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing account groups with id,displayName,externalId...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 645 account groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Group listing provided, a subset of all groups will be migrated
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] found 1 new records for groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=Group) with id,displayName,externalId,meta...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 62 Group
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=WorkspaceGroup) with id,displayName,meta,externalId,members,roles,entitlements...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 9 WorkspaceGroup
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Renaming: ucx_us8o -> rename-CYhM-ucx_us8o
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing account groups with id,displayName,externalId...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 646 account groups
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Listing workspace groups (resource_type=Group) with id,displayName,externalId,meta...
10:30 INFO [databricks.labs.ucx.workspace_access.groups] Found 62 Group
10:30 DEBUG [databricks.labs.ucx.framework.crawlers] [hive_metastore.ucx_syltc.groups] fetching groups inventory
10:30 DEBUG [databricks.labs.ucx.installer.workflows] starting remove-workspace-local-backup-groups job: https://DATABRICKS_HOST#job/723555959892053
10:34 INFO [databricks.labs.ucx.install] Deleting UCX v0.21.1+10620240422103450 from https://DATABRICKS_HOST
10:34 INFO [databricks.labs.ucx.install] Deleting inventory database ucx_syltc
10:34 INFO [databricks.labs.ucx.install] Deleting jobs
10:34 INFO [databricks.labs.ucx.install] Deleting migrate-groups job_id=117470670062481.
10:34 INFO [databricks.labs.ucx.install] Deleting validate-groups-permissions job_id=586390267877175.
10:34 INFO [databricks.labs.ucx.install] Deleting migrate-groups-experimental job_id=915351892247023.
10:34 INFO [databricks.labs.ucx.install] Deleting failing job_id=1044198637435509.
10:34 INFO [databricks.labs.ucx.install] Deleting migrate-tables-in-mounts-experimental job_id=1080128102623119.
10:34 INFO [databricks.labs.ucx.install] Deleting assessment job_id=544155594831834.
10:34 INFO [databricks.labs.ucx.install] Deleting migrate-tables job_id=912514469387892.
10:34 INFO [databricks.labs.ucx.install] Deleting remove-workspace-local-backup-groups job_id=723555959892053.
10:34 INFO [databricks.labs.ucx.install] Deleting cluster policy
10:34 INFO [databricks.labs.ucx.install] Deleting secret scope
10:34 INFO [databricks.labs.ucx.install] UnInstalling UCX complete
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 1 workspace user fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] removing workspace user fixture: User(active=True, display_name='[email protected]', emails=[ComplexValue(display=None, primary=True, ref=None, type='work', value='[email protected]')], entitlements=[], external_id=None, groups=[], id='6603457138622490', name=Name(family_name=None, given_name='[email protected]'), roles=[], schemas=[<UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_USER: 'urn:ietf:params:scim:schemas:core:2.0:User'>, <UserSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_EXTENSION_WORKSPACE_2_0_USER: 'urn:ietf:params:scim:schemas:extension:workspace:2.0:User'>], user_name='[email protected]')
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 1 account group fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] removing account group fixture: Group(display_name='ucx_us8o', entitlements=[], external_id=None, groups=[], id='639056309626039', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=None, roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 1 workspace group fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] removing workspace group fixture: Group(display_name='ucx_us8o', entitlements=[ComplexValue(display=None, primary=None, ref=None, type=None, value='allow-cluster-create')], external_id=None, groups=[], id='721739124880534', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=ResourceMeta(resource_type='WorkspaceGroup'), roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>])
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] ignoring error while workspace group Group(display_name='ucx_us8o', entitlements=[ComplexValue(display=None, primary=None, ref=None, type=None, value='allow-cluster-create')], external_id=None, groups=[], id='721739124880534', members=[ComplexValue(display='[email protected]', primary=None, ref='Users/6603457138622490', type=None, value='6603457138622490')], meta=ResourceMeta(resource_type='WorkspaceGroup'), roles=[], schemas=[<GroupSchema.URN_IETF_PARAMS_SCIM_SCHEMAS_CORE_2_0_GROUP: 'urn:ietf:params:scim:schemas:core:2.0:Group'>]) teardown: None Group with id 721739124880534 not found.
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 0 table fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 0 table fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] clearing 1 schema fixtures
10:34 DEBUG [databricks.labs.ucx.mixins.fixtures] removing schema fixture: SchemaInfo(browse_only=None, catalog_name='hive_metastore', catalog_type=None, comment=None, created_at=None, created_by=None, effective_predictive_optimization_flag=None, enable_predictive_optimization=None, full_name='hive_metastore.ucx_syltc', metastore_id=None, name='ucx_syltc', owner=None, properties=None, storage_location=None, storage_root=None, updated_at=None, updated_by=None)
[gw7] linux -- Python 3.10.14 /home/runner/work/ucx/ucx/.venv/bin/python

Flaky tests:

  • 🤪 test_migrate_dbfs_non_delta_tables (35.715s)
  • 🤪 test_delete_ws_groups_should_delete_renamed_and_reflected_groups_only (2m45.077s)

Running from acceptance #2510

Copy link
Copy Markdown
Collaborator

@nfx nfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few changes required

self._product_info = product_info
self._force_install = environ.get("UCX_FORCE_INSTALL")
self._is_account_install = environ.get("UCX_FORCE_INSTALL") == "account"
try:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nkvuong it's more logical to have this as @cached_property. please rewrite

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

wheel_builder_factory = self._new_wheel_builder
wheels = wheel_builder_factory()
install_state = InstallState.from_installation(self._installation)
install_state = InstallState.from_installation(self.installation)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have the self.install_state from GlobalContext

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

config,
self._installation,
self.installation,
install_state,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
install_state,
self.install_state,

warehouse_id = self._configure_warehouse()

policy_id, instance_profile, spark_conf_dict, instance_pool_id = self._policy_installer.create(
policy_installer = ClusterPolicyInstaller(self.installation, self.workspace_client, self.prompts)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating @cached_property of ClusterPolicyInstaller will simplify the testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

def _apply_upgrades(self):
try:
upgrades = Upgrades(self._product_info, self._installation)
upgrades = Upgrades(self.product_info, self.installation)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

creating @cached_property of Upgrades will simplify the testing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

skip_dashboards=False,
):
self._config = config
self._installation = installation
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't extend the WorkspaceContext, so you can't change the visibility of properties in WorkspaceInstallation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, overzealous find & replace

@nfx nfx changed the title refactor WorkspaceInstaller using service factory Refactor WorkspaceInstaller using service factory Apr 22, 2024
@nfx nfx added the tech debt chores and design flaws label Apr 22, 2024
@nkvuong nkvuong force-pushed the refactor/workspace_installer branch from 49bdb89 to 19ec79d Compare April 22, 2024 17:59
@nkvuong nkvuong requested a review from nfx April 22, 2024 17:59
Copy link
Copy Markdown
Collaborator

@nfx nfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few nits, stamping to unblock

class WorkspaceInstaller:
class WorkspaceInstaller(WorkspaceContext):

@cached_property
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it's VERY uncommon for methods to be declared before the constructor. can you move them below constructor?..

Copy link
Copy Markdown
Collaborator

@nfx nfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nfx nfx merged commit b13c4d9 into main Apr 22, 2024
@nfx nfx deleted the refactor/workspace_installer branch April 22, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tech debt chores and design flaws

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants