Datalayer VS Code Extension - v0.0.9
    Preparing search index...

    Abstract base class for kernel manager implementations.

    Implements common Kernel.IManager interface methods that are identical across all manager types, reducing code duplication and ensuring consistency.

    This class implements both the standard JupyterLab Kernel.IManager interface and the custom ITypedKernelManager interface for type discrimination.

    class MyKernelManager extends BaseKernelManager {
    readonly managerType = 'custom' as const;

    async startNew(options?: any): Promise<Kernel.IKernelConnection> {
    // Custom kernel creation logic
    }
    }

    Implements

    Index

    Constructors

    Properties

    _activeKernel: IKernelConnection = null

    Currently active kernel connection. Most custom managers (mock, Pyodide, local) support only one kernel at a time.

    _connectionFailure: Signal<BaseKernelManager, Error> = ...

    Signal emitted when connection to kernel fails. Used for error propagation to UI components.

    _disposed: Signal<BaseKernelManager, void> = ...

    Signal emitted when manager is disposed. Used for cleanup and resource management.

    _isDisposed: boolean = false

    Disposal state flag.

    _isReady: boolean = true

    Ready state flag. True for synchronous managers (mock, Pyodide, local).

    _ready: Promise<void> = ...

    Ready promise that resolves immediately. All custom managers are ready synchronously.

    _runningChanged: Signal<BaseKernelManager, IModel[]> = ...

    Signal emitted when running kernels change. Emitted after kernel startup, shutdown, or disposal.

    managerType: KernelManagerType

    Type identifier for this kernel manager. Must be implemented by subclasses.

    serverSettings: ISettings

    Jupyter server connection settings

    Accessors

    • get connectionFailure(): ISignal<this, Error>

      Signal emitted when kernel connection fails.

      Returns ISignal<this, Error>

      manager.connectionFailure.connect((sender, error) => {
      console.error('Kernel connection failed:', error);
      });
    • get disposed(): ISignal<this, void>

      Signal emitted when manager is disposed. Used for cleanup in consuming components.

      Returns ISignal<this, void>

    • get isReady(): boolean

      Whether the manager is ready to create kernels. Always true for custom managers (mock, Pyodide, local).

      Returns boolean

    • get ready(): Promise<void>

      Promise that resolves when manager is ready. Resolves immediately for custom managers.

      Returns Promise<void>

    • get runningChanged(): ISignal<this, IModel[]>

      Signal emitted when running kernels change.

      Returns ISignal<this, IModel[]>

      manager.runningChanged.connect((sender, models) => {
      console.log(`Running kernels: ${models.length}`);
      });
    • get runningCount(): number

      Number of currently running kernels. For single-kernel managers (mock, Pyodide, local), returns 0 or 1.

      Returns number

    Methods

    • Connect to an existing kernel.

      For single-kernel managers, typically returns the active kernel or throws an error. Override for custom behavior.

      Parameters

      • _options: IOptions

        Connection options (unused in base implementation)

      Returns IKernelConnection

      Kernel connection

    • Dispose of the kernel manager and all resources.

      Shuts down active kernels, disconnects signals, marks as disposed. Subclasses should call super.dispose() after their cleanup.

      Returns void

    • Find a kernel by ID.

      Standard implementation checks if the active kernel matches.

      Parameters

      • id: string

        Kernel identifier

      Returns Promise<IModel>

      Kernel model if found, undefined otherwise

    • Unified logging helper with manager type prefix.

      Parameters

      • message: string

        Log message

      • ...args: unknown[]

        Additional arguments to log

      Returns void

      this.log("Starting kernel", { name: "python3" });
      // Output: [PyodideKernelManager] Starting kernel { name: "python3" }
    • Refresh the list of running kernels.

      No-op for custom managers that don't poll a server. Override in remote managers that need to sync with server state.

      Returns Promise<void>

    • Request the list of running kernels from the server.

      For custom managers (mock, local, Pyodide), returns the current active kernel. Remote managers should override this to query the actual Jupyter server.

      Returns Promise<IModel[]>

      Promise resolving to array of running kernel models

    • Iterate over running kernel models.

      Standard implementation for single-kernel managers. Yields the active kernel model if one exists.

      Returns IterableIterator<IModel>

      Running kernel models

      for (const model of manager.running()) {
      console.log(`Kernel: ${model.id} (${model.name})`);
      }
    • Shut down a specific kernel by ID.

      Standard implementation for single-kernel managers. Shuts down the active kernel if IDs match, emits runningChanged signal.

      Parameters

      • id: string

        Kernel identifier to shut down

      Returns Promise<void>

      await manager.shutdown('kernel-123');
      
    • Shut down all running kernels.

      Standard implementation for single-kernel managers. Shuts down the active kernel if one exists.

      Returns Promise<void>

      await manager.shutdownAll();
      
    • Start a new kernel.

      Must be implemented by subclasses to provide manager-specific kernel creation logic.

      Parameters

      • Optionaloptions: Partial<Pick<Kernel.IModel, "name">>

        Kernel creation options (name, etc.)

      • OptionalconnectOptions: Omit<Kernel.IKernelConnection.IOptions, "model" | "serverSettings">

        Connection options (clientId, username, etc.)

      Returns Promise<IKernelConnection>

      Promise resolving to the new kernel connection

    • Validate that a kernel with the given ID exists.

      Parameters

      • id: string

        Kernel ID to validate

      Returns void

      If no active kernel or ID doesn't match