-
Notifications
You must be signed in to change notification settings - Fork 40
[8/?] feat(python-setup): merge serverless-version selection into the compute picker #2053
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6e6321e
feat(python-setup): persist serverless environment version in config
rugpanov 96ebcd8
feat(python-setup): thread serverless version through ConnectionManager
rugpanov acb370b
feat(python-setup): collect serverless versions from the bundle
rugpanov 88fdb35
feat(python-setup): pick serverless version in the compute picker
rugpanov 898599e
refactor(python-setup): call resolveServerlessVersion from the comput…
rugpanov d9cb652
feat(python-setup): collect serverless versions from notebook metadata
rugpanov 327977d
feat(python-setup): feed notebook versions into the serverless picker
rugpanov bf0579f
fix(python-setup): harden serverless-version harvesting from review
rugpanov 8e57467
perf(python-setup): pre-filter and batch the notebook version scan
rugpanov 44fa3f3
Merge branch 'main' into rugpanov/python-setup-compute-picker
rugpanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
packages/databricks-vscode/src/configuration/models/OverrideableConfigModel.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| import {expect} from "chai"; | ||
| import * as tmp from "tmp"; | ||
| import path from "node:path"; | ||
| import {readFileSync, writeFileSync} from "node:fs"; | ||
| import {Uri} from "vscode"; | ||
| import { | ||
| isOverrideableConfigKey, | ||
| OverrideableConfigModel, | ||
| } from "./OverrideableConfigModel"; | ||
|
|
||
| describe("OverrideableConfigModel serverlessVersion", () => { | ||
| const cleanups: Array<() => void> = []; | ||
| afterEach(() => { | ||
| while (cleanups.length) { | ||
| cleanups.pop()!(); | ||
| } | ||
| }); | ||
|
|
||
| function tempStorageFile(): Uri { | ||
| const dir = tmp.dirSync({unsafeCleanup: true}); | ||
| cleanups.push(dir.removeCallback); | ||
| return Uri.file(path.join(dir.name, "vscode.overrides.json")); | ||
| } | ||
|
|
||
| it("treats serverlessVersion as an overrideable key", () => { | ||
| expect(isOverrideableConfigKey("serverlessVersion")).to.equal(true); | ||
| }); | ||
|
|
||
| it("persists a serverless version alongside the serverless flag", async () => { | ||
| const file = tempStorageFile(); | ||
|
|
||
| await OverrideableConfigModel._write(file, "serverless", "dev", true); | ||
| await OverrideableConfigModel._write( | ||
| file, | ||
| "serverlessVersion", | ||
| "dev", | ||
| "5" | ||
| ); | ||
|
|
||
| const data = JSON.parse(readFileSync(file.fsPath, "utf-8")); | ||
| expect(data.serverless).to.equal(true); | ||
| expect(data.serverlessVersion).to.equal("5"); | ||
| }); | ||
|
|
||
| it("clears the version when written undefined (revert to fallback)", async () => { | ||
| const file = tempStorageFile(); | ||
| await OverrideableConfigModel._write( | ||
| file, | ||
| "serverlessVersion", | ||
| "dev", | ||
| "4" | ||
| ); | ||
|
|
||
| await OverrideableConfigModel._write( | ||
| file, | ||
| "serverlessVersion", | ||
| "dev", | ||
| undefined | ||
| ); | ||
|
|
||
| const data = JSON.parse(readFileSync(file.fsPath, "utf-8")); | ||
| expect(data.serverlessVersion).to.equal(undefined); | ||
| }); | ||
|
|
||
| it("leaves a legacy version-less serverless config untouched (backward compatible)", async () => { | ||
| const file = tempStorageFile(); | ||
| // A config written by an older extension: serverless on, no version. | ||
| writeFileSync( | ||
| file.fsPath, | ||
| JSON.stringify({serverless: true, clusterId: "abc"}) | ||
| ); | ||
|
|
||
| // Writing an unrelated key must not fabricate a serverlessVersion. | ||
| await OverrideableConfigModel._write( | ||
| file, | ||
| "authProfile", | ||
| "dev", | ||
| "DEFAULT" | ||
| ); | ||
|
|
||
| const data = JSON.parse(readFileSync(file.fsPath, "utf-8")); | ||
| expect(data.serverless).to.equal(true); | ||
| expect(data).to.not.have.property("serverlessVersion"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.