Skip to content

Commit

Permalink
Bump JS SDK (#1447)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
ilia-db authored Nov 13, 2024
1 parent 54f7376 commit aa8eae8
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"scripts": {
"install:sdk": "yarn fetch:sdk && chmod a+x scripts/install_sdk.sh && scripts/install_sdk.sh",
"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",
"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",
"test": "yarn workspaces foreach run test",
"test:integ": "yarn workspaces foreach run test:integ",
"build": "yarn workspaces foreach run build",
Expand Down
2 changes: 1 addition & 1 deletion packages/databricks-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@
"package:copy-webview-toolkit": "cp ./node_modules/@vscode/webview-ui-toolkit/dist/toolkit.js ./out/toolkit.js",
"esbuild:base": "esbuild ./src/extension.ts --bundle --outfile=out/extension.js --external:vscode --format=cjs --platform=node --sourcemap --target=es2019",
"build": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && tsc --build --force",
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --force --verbose",
"watch": "yarn run package:wrappers:write && yarn run package:jupyter-init-script:write && yarn run package:copy-webview-toolkit && tsc --build --watch --verbose",
"fix": "eslint src --ext ts --fix && prettier . --write",
"test:lint": "eslint src --ext ts && prettier . -c",
"test:unit": "yarn run build && node ./out/test/runTest.js",
Expand Down
4 changes: 0 additions & 4 deletions packages/databricks-vscode/src/cluster/ClusterLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ export class ClusterLoader implements Disposable {

const clusters: Array<Cluster> = [];
for await (const c of Cluster.list(apiClient)) {
if (!["UI", "API"].includes(c.source)) {
continue;
}

if (
workspaceConfigs.onlyShowAccessibleClusters &&
c.isSingleUser() &&
Expand Down
4 changes: 2 additions & 2 deletions packages/databricks-vscode/src/cluster/ClusterManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe(__filename, async () => {
mockedClient = mock(ApiClient);
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
// eslint-disable-next-line
Expand All @@ -57,7 +57,7 @@ describe(__filename, async () => {
it("should start a cluster with progress", async () => {
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
// eslint-disable-next-line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class EnvironmentDependenciesVerifier extends MultiStepAccessVerifier {
async checkWorkspaceHasUc(@context ctx?: Context) {
try {
const catalogList =
this.connectionManager.workspaceClient?.catalogs.list();
this.connectionManager.workspaceClient?.catalogs.list({});
const catalogListIter = catalogList
? catalogList[Symbol.asyncIterator]()
: undefined;
Expand Down
24 changes: 12 additions & 12 deletions packages/databricks-vscode/src/sdk-extensions/Cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe(__filename, function () {
it("calling start on a non terminated state should not throw an error", async () => {
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand Down Expand Up @@ -74,7 +74,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
anything(),
anything(),
anything()
Expand All @@ -83,7 +83,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/start",
"/api/2.1/clusters/start",
anything(),
anything(),
anything()
Expand All @@ -94,7 +94,7 @@ describe(__filename, function () {
it("should terminate cluster", async () => {
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand All @@ -118,7 +118,7 @@ describe(__filename, function () {

when(
mockedClient.request(
"/api/2.0/clusters/delete",
"/api/2.1/clusters/delete",
"POST",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand All @@ -137,7 +137,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
anything(),
anything(),
anything()
Expand All @@ -146,7 +146,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/delete",
"/api/2.1/clusters/delete",
anything(),
anything(),
anything()
Expand All @@ -157,7 +157,7 @@ describe(__filename, function () {
it("should terminate non running clusters", async () => {
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand Down Expand Up @@ -190,7 +190,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
anything(),
anything(),
anything()
Expand All @@ -199,7 +199,7 @@ describe(__filename, function () {

verify(
mockedClient.request(
"/api/2.0/clusters/delete",
"/api/2.1/clusters/delete",
anything(),
anything(),
anything()
Expand All @@ -210,7 +210,7 @@ describe(__filename, function () {
it("should cancel cluster start", async () => {
const whenMockGetCluster = when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand All @@ -226,7 +226,7 @@ describe(__filename, function () {

when(
mockedClient.request(
"/api/2.0/clusters/delete",
"/api/2.1/clusters/delete",
"POST",
deepEqual({
cluster_id: testClusterDetails.cluster_id,
Expand Down
6 changes: 4 additions & 2 deletions packages/databricks-vscode/src/sdk-extensions/Cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ export class Cluster {
): Promise<Cluster | undefined> {
const clusterApi = new compute.ClustersService(client);

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

for await (const clusterInfo of clusterApi.list({can_use_client: ""})) {
for await (const clusterInfo of clusterApi.list({
filter_by: {cluster_sources: ["API", "UI"]},
})) {
yield new Cluster(client, clusterInfo);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/databricks-vscode/src/sdk-extensions/Repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class Repo {
@logging.withLogContext(logging.ExposedLoggers.SDK)
static async create(
client: ApiClient,
req: workspace.CreateRepo,
req: workspace.CreateRepoRequest,
@context context?: Context
) {
const repoService = new workspace.ReposService(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function getMockTestCluster() {
const mockedClient = mock(ApiClient);
when(
mockedClient.request(
"/api/2.0/clusters/get",
"/api/2.1/clusters/get",
"GET",
anything(),
anything()
Expand Down
Binary file modified vendor/databricks-sdk.tgz
Binary file not shown.
26 changes: 13 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -284,32 +284,32 @@ __metadata:
linkType: hard

"@databricks/databricks-sdk@file:../../vendor/databricks-sdk.tgz::locator=%40databricks%2Fdatabricks-vscode-types%40workspace%3Apackages%2Fdatabricks-vscode-types":
version: 0.6.2
version: 0.7.0
resolution: "@databricks/databricks-sdk@file:../../vendor/databricks-sdk.tgz::locator=%40databricks%2Fdatabricks-vscode-types%40workspace%3Apackages%2Fdatabricks-vscode-types"
dependencies:
"@types/ini": ^4.1.0
"@types/node": ^18.19.23
"@types/semver": ^7.5.8
google-auth-library: ^9.6.3
google-auth-library: ^9.10.0
ini: ^4.1.2
reflect-metadata: ^0.2.1
semver: ^7.6.0
checksum: 84c9f44a5e807b176e0375658e44abe8ac0772d193e3aadbddb06da0d0fbf61696a6102f4e6fa06bf917d16247166b497f5ac7d6c32a4c0ea3fd23b269a2c6d3
checksum: fc3186dc4dda2a06e01c8e7e20b5f76ec6d1b4379b65deb80cacfd506427f38841af890858bd3335c3ab76f8a7255c4f4ce295f6470d7d0905f236b211fa617b
languageName: node
linkType: hard

"@databricks/databricks-sdk@file:../../vendor/databricks-sdk.tgz::locator=databricks%40workspace%3Apackages%2Fdatabricks-vscode":
version: 0.6.2
version: 0.7.0
resolution: "@databricks/databricks-sdk@file:../../vendor/databricks-sdk.tgz::locator=databricks%40workspace%3Apackages%2Fdatabricks-vscode"
dependencies:
"@types/ini": ^4.1.0
"@types/node": ^18.19.23
"@types/semver": ^7.5.8
google-auth-library: ^9.6.3
google-auth-library: ^9.10.0
ini: ^4.1.2
reflect-metadata: ^0.2.1
semver: ^7.6.0
checksum: 84c9f44a5e807b176e0375658e44abe8ac0772d193e3aadbddb06da0d0fbf61696a6102f4e6fa06bf917d16247166b497f5ac7d6c32a4c0ea3fd23b269a2c6d3
checksum: fc3186dc4dda2a06e01c8e7e20b5f76ec6d1b4379b65deb80cacfd506427f38841af890858bd3335c3ab76f8a7255c4f4ce295f6470d7d0905f236b211fa617b
languageName: node
linkType: hard

Expand Down Expand Up @@ -1448,11 +1448,11 @@ __metadata:
linkType: hard

"@types/node@npm:^18.19.23":
version: 18.19.50
resolution: "@types/node@npm:18.19.50"
version: 18.19.64
resolution: "@types/node@npm:18.19.64"
dependencies:
undici-types: ~5.26.4
checksum: 73bdd2b46fb96816a1f7309e1b609f0832a29739c87df7daa729ff497160be143e02cf18486a0112e1981b092358aed3ca0716b532aff93c7e05f7dbb4f7586a
checksum: e7680215b03c9bee8a33947f03d06048e8e460f23b1b7b29c45350cf437faa5f8fcb7d8c3eb8dfec8427923e7a184df42bc710c1b6252b4852e3ed7064c6228f
languageName: node
linkType: hard

Expand Down Expand Up @@ -5712,17 +5712,17 @@ __metadata:
languageName: node
linkType: hard

"google-auth-library@npm:^9.6.3":
version: 9.14.1
resolution: "google-auth-library@npm:9.14.1"
"google-auth-library@npm:^9.10.0":
version: 9.14.2
resolution: "google-auth-library@npm:9.14.2"
dependencies:
base64-js: ^1.3.0
ecdsa-sig-formatter: ^1.0.11
gaxios: ^6.1.1
gcp-metadata: ^6.1.0
gtoken: ^7.0.0
jws: ^4.0.0
checksum: 98c7ffb6ef8d811a54d728a94c31aa60c777f035306f0ded70654ce0aa1f4dcf393bb505b262aa48438f5ead8941248f3759f24f0e22b4465b8537b1d90415ac
checksum: 64b3a6c1b1b14f1c891dbcfb850bc4db63dc8fae17e70197636244d00c83b539ac3da8688aae0bd1f09c884fc538d203945ae751edbabf666b41066385d86e30
languageName: node
linkType: hard

Expand Down

0 comments on commit aa8eae8

Please sign in to comment.