Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to initialisation UI #1160

Merged
merged 7 commits into from
Apr 3, 2024
Merged

Fixes to initialisation UI #1160

merged 7 commits into from
Apr 3, 2024

Conversation

kartikgupta-db
Copy link
Contributor

Changes

Welcome view changes

  • Always show button to create a databricks project.
  • Don't automatically migrate from old project.json if there are subprojects present.
  • Reword welcome view buttons and text
image

Login Changes

  • Don't logout if refreshing one of the models fails. This means users can see the error, fix it and have their fixes automatically be picked up and tried out.
  • Show "Multiple login profiles available. Click to select a profile." when multiple profiles found in .databrickscfg.

Tests

}
});
} else if (e instanceof Error) {
if (e instanceof Error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

With allSettled we are swallowing normal errors right now, we should re-throw them in setTarget/setAuthProvider methods.

But I'm not sure why should we move error handling over there? Seems easier to just have Promise.all and catch everything here. Plus we need to add error handling to ConnectionCommands.selectTarget too.

Copy link
Contributor Author

@kartikgupta-db kartikgupta-db Mar 28, 2024

Choose a reason for hiding this comment

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

Removed all settled. I split setting target/auth provider and doing state refresh into 2 separate steps. Now, auth provider and target will still be updated in all models, even if there are some errors. Then, errors are propagated normally from refresh.

@@ -105,6 +105,10 @@ export class ClusterComponent extends BaseComponent {
new ThemeColor("notificationsErrorIcon.foreground")
),
id: TREE_ICON_ID,
command: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's remove the command from the package.json->view/item/context then?

const label = "Login to Databricks";
const host = await this.configModel.get("host");
if (host === undefined) {
return [];
Copy link
Contributor

Choose a reason for hiding this comment

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

If the bundle doesn't have a host defined we show a "failed to initialize target" notification right now, and then end up in a broken state when you can't really switch target anymore or even trigger the error again.

At least here it would make sense to show a message about the absent host and prompt users to open and update the dabs config

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed this state as well. Now we show a message saying "host is misconfigured". And once user fixes it, changes are picked up and processed automatically.

@@ -214,12 +215,32 @@ export class ConfigModel implements Disposable {
// We want to wait for all the configs to be loaded before we emit any change events from the
// configStateCache.
await this.readStateMutex.synchronise(async () => {
await Promise.all([
await Promise.allSettled([
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it intentional that we never fail here anymore and always proceed to the setAuthProvider? setAuthProvider doesn't fail too with allSettled, so we are swallowing non-ProcessError errors now, breaking some of the higher-level error handling (in the ConnectionManager and ConnectionCommands)

Copy link
Contributor Author

@kartikgupta-db kartikgupta-db Mar 27, 2024

Choose a reason for hiding this comment

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

Yes. The idea is to not block login based on errors here, and also actually run all the promises parallely. I agree that we should show error messages for other errors as well.

Right now, when any of the models fail to refresh, we completely logout, and user has to log back in. With this change, the user can make changes and fixes to their bundle, which will automatically refresh the models and these fixes will then propagate back to the UI

this.bundleValidateModel.setTarget(target);
this.overrideableConfigModel.setTarget(target);
this.bundleRemoteStateModel.setTarget(target);
this.onDidChangeTargetEmitter.fire();
Copy link
Contributor

@ilia-db ilia-db Apr 2, 2024

Choose a reason for hiding this comment

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

I wonder if we now have a race condition because you emit the target change before refreshing the models? During the refresh the connection manager tries to login with saved auth and might use stale values from the configModel (since its refresh is tied to the refreshes of other models, which might not happen in time)

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we emit the target change at the very end of the method?

Copy link
Contributor Author

@kartikgupta-db kartikgupta-db Apr 3, 2024

Choose a reason for hiding this comment

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

Made it emit at the end.

@kartikgupta-db kartikgupta-db merged commit 77267f4 into bundle-integ Apr 3, 2024
3 checks passed
@kartikgupta-db kartikgupta-db deleted the welcome-views branch April 3, 2024 13:36
@github-actions github-actions bot mentioned this pull request Apr 3, 2024
kartikgupta-db added a commit that referenced this pull request Apr 3, 2024
## packages/databricks-vscode
##  (2024-04-03)

* Add currently selected python environment to path for wheel builds
(#1159)
([2128013](2128013)),
closes
[#1159](#1159)
* Add extension name to the private preview terms and conditions popup
(#1144)
([5370f04](5370f04)),
closes
[#1144](#1144)
* Bump databricks cli to v0.216.0 (#1166)
([fdd0a17](fdd0a17)),
closes
[#1166](#1166)
* Fixes to initialisation UI (#1160)
([77267f4](77267f4)),
closes
[#1160](#1160)
* Ignore stderr for validate and summary commands (#1151)
([3780ec4](3780ec4)),
closes
[#1151](#1151)
* Rename some things (#1146)
([450b002](450b002)),
closes
[#1146](#1146)
* Use packaged CLI if a cli path is not specified in .databrickscfg
profile (#1150)
([2cff68e](2cff68e)),
closes
[#1150](#1150)



## packages/databricks-vscode-types
##  (2024-04-03)

---------

Co-authored-by: releasebot <noreply@github.com>
Co-authored-by: Kartik Gupta <88345179+kartikgupta-db@users.noreply.github.com>
Co-authored-by: kartikgupta-db <kartik.gupta@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants