diff --git a/CHANGELOG.md b/CHANGELOG.md index c828d5e..a80c92b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Release Notes +**v2.4.0:** +- added interactive kernel again ([202](/../../issues/202)) + **v2.3.6:** - fixed another issue with expiring tokens ([196](/../../issues/196)) diff --git a/package.json b/package.json index 77225e4..b074794 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "databricks-vscode", "displayName": "Databricks Power Tools", "description": "Run notebooks cell-by-cell, browse and edit your Databricks Workspace, DBFS, Clusters, Jobs, Secrets, Repos and SQL. Supports Azure Databricks, Databricks on AWS and Databricks on GCP.", - "version": "2.3.6", + "version": "2.4.0", "publisher": "paiqo", "icon": "resources/databricks_extension.png", "author": { diff --git a/src/vscode/notebook/DatabricksKernel.ts b/src/vscode/notebook/DatabricksKernel.ts index 0c45fca..75ab492 100644 --- a/src/vscode/notebook/DatabricksKernel.ts +++ b/src/vscode/notebook/DatabricksKernel.ts @@ -28,6 +28,7 @@ export type NotebookMagic = export type KernelType = "jupyter-notebook" | "databricks-notebook" + | "interactive" // https://code.visualstudio.com/blogs/2021/11/08/custom-notebooks export class DatabricksKernel implements vscode.NotebookController { diff --git a/src/vscode/notebook/DatabricksKernelManager.ts b/src/vscode/notebook/DatabricksKernelManager.ts index 8b0aa6d..4c318e9 100644 --- a/src/vscode/notebook/DatabricksKernelManager.ts +++ b/src/vscode/notebook/DatabricksKernelManager.ts @@ -9,6 +9,7 @@ import { DatabricksKernel } from './DatabricksKernel'; export abstract class DatabricksKernelManager { private static JupyterKernelSuffix: string = "-jupyter-notebook"; private static DatabricksKernelSuffix: string = "-databricks-notebook"; + private static InteractiveKernelSuffix: string = "-databricks.interactive"; private static _kernels: Map = new Map(); @@ -109,6 +110,21 @@ export abstract class DatabricksKernelManager { return false; } + static getInteractiveKernelName(cluster: iDatabricksCluster): string { + return cluster.cluster_id + DatabricksKernelManager.InteractiveKernelSuffix; + } + + static getInteractiveKernel(cluster: iDatabricksCluster): DatabricksKernel { + return this.getKernel(this.getInteractiveKernelName(cluster)); + } + + static interactiveKernelExists(cluster: iDatabricksCluster): boolean { + if (this.getInteractiveKernel(cluster)) { + return true; + } + return false; + } + static async createKernels(cluster: iDatabricksCluster, logMessages: boolean = true): Promise { if (!this.jupyterKernelExists(cluster)) { let notebookKernel: DatabricksKernel = new DatabricksKernel(cluster, "jupyter-notebook"); @@ -135,6 +151,19 @@ export abstract class DatabricksKernelManager { ThisExtension.log(`Databricks Kernel for Databricks cluster '${cluster.cluster_id}' already exists!`) } } + + if (!this.interactiveKernelExists(cluster)) { + let interactiveKernel: DatabricksKernel = new DatabricksKernel(cluster, "interactive"); + this.setKernel(this.getInteractiveKernelName(cluster), interactiveKernel); + if (logMessages) { + ThisExtension.log(`Interactive Kernel for Databricks cluster '${cluster.cluster_id}' created!`) + } + } + else { + if (logMessages) { + ThisExtension.log(`Interactive Kernel for Databricks cluster '${cluster.cluster_id}' already exists!`) + } + } } static async removeKernels(cluster: iDatabricksCluster, logMessages: boolean = true): Promise {