Skip to content

Commit aa8eae8

Browse files
authored
Bump JS SDK (#1447)
## Changes Requires changes on the JS SDK side to be merged first. The main notable change is that clusters API went from 2.0 to 2.1 in backwards incompatible way. ## Tests e2e and manual tests
1 parent 54f7376 commit aa8eae8

File tree

11 files changed

+36
-38
lines changed

11 files changed

+36
-38
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"scripts": {
1616
"install:sdk": "yarn fetch:sdk && chmod a+x scripts/install_sdk.sh && scripts/install_sdk.sh",
17-
"fetch:sdk": "rm -rf vendor && mkdir vendor && gh release download -R databricks/databricks-sdk-js v0.6.2 -p '*.tgz' && mv *.tgz vendor/databricks-sdk.tgz",
17+
"fetch:sdk": "rm -rf vendor && mkdir vendor && gh release download -R databricks/databricks-sdk-js v0.7.0 -p '*.tgz' && mv *.tgz vendor/databricks-sdk.tgz",
1818
"test": "yarn workspaces foreach run test",
1919
"test:integ": "yarn workspaces foreach run test:integ",
2020
"build": "yarn workspaces foreach run build",

packages/databricks-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@
954954
"package:copy-webview-toolkit": "cp ./node_modules/@vscode/webview-ui-toolkit/dist/toolkit.js ./out/toolkit.js",
955955
"esbuild:base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node --sourcemap --target=es2019",
956956
"build": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && tsc --build --force",
957-
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --force --verbose",
957+
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --verbose",
958958
"fix": "eslint src --ext ts --fix && prettier . --write",
959959
"test:lint": "eslint src --ext ts && prettier . -c",
960960
"test:unit": "yarn run build && node ./out/test/runTest.js",

packages/databricks-vscode/src/cluster/ClusterLoader.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@ export class ClusterLoader implements Disposable {
8080

8181
const clusters: Array<Cluster> = [];
8282
for await (const c of Cluster.list(apiClient)) {
83-
if (!["UI", "API"].includes(c.source)) {
84-
continue;
85-
}
86-
8783
if (
8884
workspaceConfigs.onlyShowAccessibleClusters &&
8985
c.isSingleUser() &&

packages/databricks-vscode/src/cluster/ClusterManager.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe(__filename, async () => {
3030
mockedClient = mock(ApiClient);
3131
when(
3232
mockedClient.request(
33-
"/api/2.0/clusters/get",
33+
"/api/2.1/clusters/get",
3434
"GET",
3535
deepEqual({
3636
// eslint-disable-next-line
@@ -57,7 +57,7 @@ describe(__filename, async () => {
5757
it("should start a cluster with progress", async () => {
5858
when(
5959
mockedClient.request(
60-
"/api/2.0/clusters/get",
60+
"/api/2.1/clusters/get",
6161
"GET",
6262
deepEqual({
6363
// eslint-disable-next-line

packages/databricks-vscode/src/language/EnvironmentDependenciesVerifier.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export class EnvironmentDependenciesVerifier extends MultiStepAccessVerifier {
117117
async checkWorkspaceHasUc(@context ctx?: Context) {
118118
try {
119119
const catalogList =
120-
this.connectionManager.workspaceClient?.catalogs.list();
120+
this.connectionManager.workspaceClient?.catalogs.list({});
121121
const catalogListIter = catalogList
122122
? catalogList[Symbol.asyncIterator]()
123123
: undefined;

packages/databricks-vscode/src/sdk-extensions/Cluster.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe(__filename, function () {
3030
it("calling start on a non terminated state should not throw an error", async () => {
3131
when(
3232
mockedClient.request(
33-
"/api/2.0/clusters/get",
33+
"/api/2.1/clusters/get",
3434
"GET",
3535
deepEqual({
3636
cluster_id: testClusterDetails.cluster_id,
@@ -74,7 +74,7 @@ describe(__filename, function () {
7474

7575
verify(
7676
mockedClient.request(
77-
"/api/2.0/clusters/get",
77+
"/api/2.1/clusters/get",
7878
anything(),
7979
anything(),
8080
anything()
@@ -83,7 +83,7 @@ describe(__filename, function () {
8383

8484
verify(
8585
mockedClient.request(
86-
"/api/2.0/clusters/start",
86+
"/api/2.1/clusters/start",
8787
anything(),
8888
anything(),
8989
anything()
@@ -94,7 +94,7 @@ describe(__filename, function () {
9494
it("should terminate cluster", async () => {
9595
when(
9696
mockedClient.request(
97-
"/api/2.0/clusters/get",
97+
"/api/2.1/clusters/get",
9898
"GET",
9999
deepEqual({
100100
cluster_id: testClusterDetails.cluster_id,
@@ -118,7 +118,7 @@ describe(__filename, function () {
118118

119119
when(
120120
mockedClient.request(
121-
"/api/2.0/clusters/delete",
121+
"/api/2.1/clusters/delete",
122122
"POST",
123123
deepEqual({
124124
cluster_id: testClusterDetails.cluster_id,
@@ -137,7 +137,7 @@ describe(__filename, function () {
137137

138138
verify(
139139
mockedClient.request(
140-
"/api/2.0/clusters/get",
140+
"/api/2.1/clusters/get",
141141
anything(),
142142
anything(),
143143
anything()
@@ -146,7 +146,7 @@ describe(__filename, function () {
146146

147147
verify(
148148
mockedClient.request(
149-
"/api/2.0/clusters/delete",
149+
"/api/2.1/clusters/delete",
150150
anything(),
151151
anything(),
152152
anything()
@@ -157,7 +157,7 @@ describe(__filename, function () {
157157
it("should terminate non running clusters", async () => {
158158
when(
159159
mockedClient.request(
160-
"/api/2.0/clusters/get",
160+
"/api/2.1/clusters/get",
161161
"GET",
162162
deepEqual({
163163
cluster_id: testClusterDetails.cluster_id,
@@ -190,7 +190,7 @@ describe(__filename, function () {
190190

191191
verify(
192192
mockedClient.request(
193-
"/api/2.0/clusters/get",
193+
"/api/2.1/clusters/get",
194194
anything(),
195195
anything(),
196196
anything()
@@ -199,7 +199,7 @@ describe(__filename, function () {
199199

200200
verify(
201201
mockedClient.request(
202-
"/api/2.0/clusters/delete",
202+
"/api/2.1/clusters/delete",
203203
anything(),
204204
anything(),
205205
anything()
@@ -210,7 +210,7 @@ describe(__filename, function () {
210210
it("should cancel cluster start", async () => {
211211
const whenMockGetCluster = when(
212212
mockedClient.request(
213-
"/api/2.0/clusters/get",
213+
"/api/2.1/clusters/get",
214214
"GET",
215215
deepEqual({
216216
cluster_id: testClusterDetails.cluster_id,
@@ -226,7 +226,7 @@ describe(__filename, function () {
226226

227227
when(
228228
mockedClient.request(
229-
"/api/2.0/clusters/delete",
229+
"/api/2.1/clusters/delete",
230230
"POST",
231231
deepEqual({
232232
cluster_id: testClusterDetails.cluster_id,

packages/databricks-vscode/src/sdk-extensions/Cluster.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ export class Cluster {
331331
): Promise<Cluster | undefined> {
332332
const clusterApi = new compute.ClustersService(client);
333333

334-
for await (const clusterInfo of clusterApi.list({can_use_client: ""})) {
334+
for await (const clusterInfo of clusterApi.list({})) {
335335
if (clusterInfo.cluster_name === clusterName) {
336336
const cluster = await clusterApi.get({
337337
cluster_id: clusterInfo.cluster_id!,
@@ -355,7 +355,9 @@ export class Cluster {
355355
static async *list(client: ApiClient): AsyncIterable<Cluster> {
356356
const clusterApi = new compute.ClustersService(client);
357357

358-
for await (const clusterInfo of clusterApi.list({can_use_client: ""})) {
358+
for await (const clusterInfo of clusterApi.list({
359+
filter_by: {cluster_sources: ["API", "UI"]},
360+
})) {
359361
yield new Cluster(client, clusterInfo);
360362
}
361363
}

packages/databricks-vscode/src/sdk-extensions/Repos.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Repo {
4141
@logging.withLogContext(logging.ExposedLoggers.SDK)
4242
static async create(
4343
client: ApiClient,
44-
req: workspace.CreateRepo,
44+
req: workspace.CreateRepoRequest,
4545
@context context?: Context
4646
) {
4747
const repoService = new workspace.ReposService(client);

packages/databricks-vscode/src/sdk-extensions/test/ClusterFixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function getMockTestCluster() {
1313
const mockedClient = mock(ApiClient);
1414
when(
1515
mockedClient.request(
16-
"/api/2.0/clusters/get",
16+
"/api/2.1/clusters/get",
1717
"GET",
1818
anything(),
1919
anything()

vendor/databricks-sdk.tgz

94.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)