-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Traverse parent directories to find and load .databricks/.databricks.…
…env from notebook init script (#845) ## Changes * also show restart-python-kernels dialogue box more prominently, ## Tests * manual
- Loading branch information
1 parent
65ab0c2
commit 7b43bd7
Showing
11 changed files
with
114 additions
and
51 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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
42 changes: 42 additions & 0 deletions
42
packages/databricks-vscode/src/language/notebooks/restartNotebookDialogue.ts
This file contains 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,42 @@ | ||
import {workspace, window, commands} from "vscode"; | ||
import {DatabricksEnvFileManager} from "../../file-managers/DatabricksEnvFileManager"; | ||
import {Mutex} from "../../locking"; | ||
|
||
export function showRestartNotebookDialogue( | ||
databricksEnvFileManager: DatabricksEnvFileManager | ||
) { | ||
const mutex = new Mutex(); | ||
return databricksEnvFileManager.onDidChangeEnvironmentVariables( | ||
async () => { | ||
if (!workspace.notebookDocuments.length || mutex.locked) { | ||
return; | ||
} | ||
await mutex.wait(); | ||
try { | ||
const choice = await window.showInformationMessage( | ||
"Environment variables have changed. Restart all jupyter kernels to pickup the latest environment variables. ", | ||
{ | ||
modal: true, | ||
}, | ||
"Restart All Jupyter Kernels", | ||
"Cancel" | ||
); | ||
|
||
if (choice === "Restart All Jupyter Kernels") { | ||
for (const doc of workspace.notebookDocuments) { | ||
if (doc.isClosed) { | ||
return; | ||
} | ||
await doc.save(); | ||
await window.showNotebookDocument(doc); | ||
await commands.executeCommand( | ||
"workbench.action.closeActiveEditor" | ||
); | ||
} | ||
} | ||
} finally { | ||
mutex.signal(); | ||
} | ||
} | ||
); | ||
} |
This file contains 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 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 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 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