Refactor WorkspaceInstaller using service factory#1480
Conversation
Codecov ReportAttention: Patch coverage is
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. |
|
❌ 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)Flaky tests:
Running from acceptance #2510 |
src/databricks/labs/ucx/install.py
Outdated
| self._product_info = product_info | ||
| self._force_install = environ.get("UCX_FORCE_INSTALL") | ||
| self._is_account_install = environ.get("UCX_FORCE_INSTALL") == "account" | ||
| try: |
There was a problem hiding this comment.
@nkvuong it's more logical to have this as @cached_property. please rewrite
src/databricks/labs/ucx/install.py
Outdated
| 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) |
There was a problem hiding this comment.
we already have the self.install_state from GlobalContext
src/databricks/labs/ucx/install.py
Outdated
| config, | ||
| self._installation, | ||
| self.installation, | ||
| install_state, |
There was a problem hiding this comment.
| install_state, | |
| self.install_state, |
src/databricks/labs/ucx/install.py
Outdated
| 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) |
There was a problem hiding this comment.
creating @cached_property of ClusterPolicyInstaller will simplify the testing.
src/databricks/labs/ucx/install.py
Outdated
| def _apply_upgrades(self): | ||
| try: | ||
| upgrades = Upgrades(self._product_info, self._installation) | ||
| upgrades = Upgrades(self.product_info, self.installation) |
There was a problem hiding this comment.
creating @cached_property of Upgrades will simplify the testing.
| skip_dashboards=False, | ||
| ): | ||
| self._config = config | ||
| self._installation = installation |
There was a problem hiding this comment.
you don't extend the WorkspaceContext, so you can't change the visibility of properties in WorkspaceInstallation.
There was a problem hiding this comment.
yes, overzealous find & replace
WorkspaceInstaller using service factoryWorkspaceInstaller using service factory
49bdb89 to
19ec79d
Compare
nfx
left a comment
There was a problem hiding this comment.
few nits, stamping to unblock
src/databricks/labs/ucx/install.py
Outdated
| class WorkspaceInstaller: | ||
| class WorkspaceInstaller(WorkspaceContext): | ||
|
|
||
| @cached_property |
There was a problem hiding this comment.
nit: it's VERY uncommon for methods to be declared before the constructor. can you move them below constructor?..
Co-authored-by: Serge Smertin <[email protected]>
Changes
WorkspaceInstallerusing service factory.sql_backend_factoryandwheel_builder_factorymainfunction ininstall.py, so we can achieve better test coverage through unit testingWorkspaceInstallerinunit/test_dashboard.pyLinked issues
This follows #1209
Tests