Skip to content

Commit a55eb15

Browse files
Deploy bundle before running files using remote run modes (#1019)
## Changes * Deploy the current bundle before running files using any of our remote run modes. * Upload and run file * Run as Workflow * Remove sync destination validation. We depend on bundle completely now. * Remove sync status and button to start syncing. ## Tests <!-- How is this tested? -->
1 parent ad72331 commit a55eb15

18 files changed

+331
-711
lines changed

packages/databricks-vscode/package.json

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@
150150
"title": "Run File as Workflow",
151151
"category": "Databricks",
152152
"enablement": "!inDebugMode",
153-
"icon": "$(play)"
153+
"icon": {
154+
"dark": "resources/dark/logo.svg",
155+
"light": "resources/light/logo.svg"
156+
}
154157
},
155158
{
156159
"command": "databricks.run.runEditorContents",
@@ -252,12 +255,6 @@
252255
"enablement": "databricks.context.activated && databricks.context.bundle.isTargetSet",
253256
"category": "Databricks"
254257
},
255-
{
256-
"command": "databricks.bundle.cancelAllRuns",
257-
"title": "Cancel all runs",
258-
"enablement": "databricks.context.activated && databricks.context.bundle.isTargetSet",
259-
"category": "Databricks"
260-
},
261258
{
262259
"command": "databricks.bundle.cancelRun",
263260
"title": "Cancel run",
@@ -405,16 +402,6 @@
405402
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.*$/",
406403
"group": "inline@2"
407404
},
408-
{
409-
"command": "databricks.sync.start",
410-
"when": "view == configurationView && viewItem == databricks.configuration.sync.stopped",
411-
"group": "inline@0"
412-
},
413-
{
414-
"command": "databricks.sync.stop",
415-
"when": "view == configurationView && viewItem =~ /^databricks.configuration.sync.(?!error|stopped|selected).*$/",
416-
"group": "inline@0"
417-
},
418405
{
419406
"command": "databricks.cluster.stop",
420407
"when": "view == configurationView && viewItem =~ /^databricks.configuration.cluster.(running|pending)$/",

packages/databricks-vscode/src/bundle/BundleCommands.ts

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import {Disposable, window} from "vscode";
1+
import {Disposable, ProgressLocation, window} from "vscode";
22
import {BundleRemoteStateModel} from "./models/BundleRemoteStateModel";
33
import {onError} from "../utils/onErrorDecorator";
4+
import {BundleWatcher} from "./BundleWatcher";
45
import {
56
TreeNode as BundleResourceExplorerTreeNode,
67
ResourceTreeNode as BundleResourceExplorerResourceTreeNode,
@@ -24,6 +25,28 @@ export class BundleCommands implements Disposable {
2425
"Databricks Asset Bundles"
2526
);
2627

28+
constructor(
29+
private readonly bundleRemoteStateModel: BundleRemoteStateModel,
30+
private readonly bundleRunStatusManager: BundleRunStatusManager,
31+
private readonly bundleWatcher: BundleWatcher
32+
) {
33+
this.disposables.push(
34+
this.outputChannel,
35+
this.bundleWatcher.onDidChange(async () => {
36+
await this.bundleRemoteStateModel.refresh();
37+
})
38+
);
39+
}
40+
41+
async refreshRemoteState() {
42+
await window.withProgress(
43+
{location: {viewId: "dabsResourceExplorerView"}},
44+
async () => {
45+
await this.bundleRemoteStateModel.refresh();
46+
}
47+
);
48+
}
49+
2750
private writeToChannel = (data: string) => {
2851
this.outputChannel.append(data);
2952
};
@@ -33,29 +56,29 @@ export class BundleCommands implements Disposable {
3356
this.outputChannel.appendLine("");
3457
}
3558

36-
constructor(
37-
private readonly bundleRemoteStateModel: BundleRemoteStateModel,
38-
private readonly bundleRunStatusManager: BundleRunStatusManager
39-
) {
40-
this.disposables.push(this.outputChannel);
41-
}
42-
4359
@onError({popup: {prefix: "Error refreshing remote state."}})
44-
async refreshRemoteState() {
45-
await this.bundleRemoteStateModel.refresh();
60+
async refreshRemoteStateCommand() {
61+
await this.refreshRemoteState();
4662
}
4763

48-
@onError({popup: {prefix: "Error deploying the bundle."}})
4964
async deploy() {
65+
this.prepareOutputChannel();
5066
await window.withProgress(
51-
{location: {viewId: "dabsResourceExplorerView"}},
67+
{location: ProgressLocation.Notification, cancellable: false},
5268
async () => {
5369
await this.bundleRemoteStateModel.deploy(
5470
this.writeToChannel,
5571
this.writeToChannel
5672
);
5773
}
5874
);
75+
76+
await this.refreshRemoteState();
77+
}
78+
79+
@onError({popup: {prefix: "Error deploying the bundle."}})
80+
async deployCommand() {
81+
await this.deploy();
5982
}
6083

6184
@onError({popup: {prefix: "Error running resource."}})
@@ -64,16 +87,7 @@ export class BundleCommands implements Disposable {
6487
throw new Error(`Cannot run resource of type ${treeNode.type}`);
6588
}
6689
//TODO: Don't deploy if there is no diff between local and remote state
67-
this.prepareOutputChannel();
68-
await window.withProgress(
69-
{location: {viewId: "dabsResourceExplorerView"}},
70-
async () => {
71-
await this.bundleRemoteStateModel.deploy(
72-
this.writeToChannel,
73-
this.writeToChannel
74-
);
75-
}
76-
);
90+
await this.deploy();
7791

7892
await this.bundleRunStatusManager.run(
7993
treeNode.resourceKey,

packages/databricks-vscode/src/bundle/BundleRunManager.ts

Lines changed: 0 additions & 176 deletions
This file was deleted.

packages/databricks-vscode/src/bundle/CustomOutputTerminal.ts

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)