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

    A custom KernelConnection that wraps a local kernel WebSocket. This bypasses the session management and provides a pre-connected kernel.

    Implements

    • IKernelConnection
    Index

    Constructors

    • Parameters

      • options: {
            clientId: string;
            handleComms?: boolean;
            id: string;
            model: IModel;
            name: string;
            serverSettings: ISettings;
            username?: string;
        }

      Returns LocalKernelConnection

    Properties

    _anyMessage: Signal<LocalKernelConnection, IAnyMessageArgs> = ...
    _clientId: string
    _connectionStatus: ConnectionStatus = "connected"
    _connectionStatusChanged: Signal<LocalKernelConnection, ConnectionStatus> = ...
    _disposed: Signal<LocalKernelConnection, void> = ...
    _handleComms: boolean = true
    _id: string
    _infoPromise: Promise<IInfoReply>
    _infoReply: IInfoReply = null
    _iopubMessage: Signal<LocalKernelConnection, IIOPubMessage<IOPubMessageType>> = ...
    _isDisposed: boolean = false
    _model: IModel
    _name: string
    _pendingMessages: Signal<LocalKernelConnection, boolean> = ...
    _propertyChanged: Signal<LocalKernelConnection, "path" | "name" | "type"> = ...
    _resolveInfo: (value: IInfoReply) => void
    _serverSettings: ISettings
    _status: Status = "unknown"
    _statusChanged: Signal<LocalKernelConnection, Status> = ...
    _unhandledMessage: Signal<LocalKernelConnection, IMessage<MessageType>> = ...
    _username: string = ""

    Accessors

    • get anyMessage(): ISignal<this, IAnyMessageArgs>

      A signal emitted when any kernel message is sent or received.

      This signal is emitted before any message handling has happened. The message should be treated as read-only.

      Returns ISignal<this, IAnyMessageArgs>

    • get clientId(): string

      The client unique id.

      This should be unique for a particular kernel connection object.

      Returns string

    • set clientId(value: string): void

      The client unique id.

      This should be unique for a particular kernel connection object.

      Parameters

      • value: string

      Returns void

    • get connectionStatusChanged(): ISignal<this, ConnectionStatus>

      A signal emitted when the kernel connection status changes.

      Returns ISignal<this, ConnectionStatus>

    • get hasPendingInput(): boolean

      Whether the kernel connection has pending input.

      This is a guard to avoid deadlock is the user asks input as second time before submitting his first input

      Returns boolean

    • get info(): Promise<IInfoReply>

      The kernel info

      This promise only resolves at startup, and is not refreshed on every restart.

      Returns Promise<IInfoReply>

    • get iopubMessage(): ISignal<this, IIOPubMessage<IOPubMessageType>>

      A signal emitted after an iopub kernel message is handled.

      Returns ISignal<this, IIOPubMessage<IOPubMessageType>>

    • get isDisposed(): boolean

      Test whether the object has been disposed.

      This property is always safe to access.

      Returns boolean

    • get pendingInput(): ISignal<this, boolean>

      A signal emitted when a kernel has pending inputs from the user.

      Returns ISignal<this, boolean>

    • get spec(): Promise<ISpecModel>

      Get the kernel spec.

      Returns Promise<ISpecModel>

      A promise that resolves with the kernel spec for this kernel.

      This may make a server request to retrieve the spec.

    • get statusChanged(): ISignal<this, Status>

      A signal emitted when the kernel status changes.

      Returns ISignal<this, Status>

    • get unhandledMessage(): ISignal<this, IMessage<MessageType>>

      A signal emitted for unhandled non-iopub kernel messages that claimed to be responses for messages we sent using this kernel object.

      Returns ISignal<this, IMessage<MessageType>>

    Methods

    • Clone the current kernel with a new clientId.

      Parameters

      • Optional_options: Partial<Kernel.IKernelConnection.IOptions>

      Returns IKernelConnection

    • Create a new comm.

      Parameters

      • _targetName: string
      • Optional_commId: string

      Returns IComm

      A comm instance.

    • Dispose of the resources held by the object.

      If the object's dispose method is called more than once, all calls made after the first will be a no-op.

      It is undefined behavior to use any functionality of the object after it has been disposed unless otherwise explicitly noted.

      Returns void

    • Interrupt a kernel.

      Returns Promise<void>

      A promise that resolves when the kernel has interrupted.

      Uses the Jupyter Server API.

      The promise is fulfilled on a valid response and rejected otherwise.

      It is assumed that the API call does not mutate the kernel id or name.

      The promise will be rejected if the kernel status is 'dead' or if the request fails or the response is invalid.

    • Reconnect to a disconnected kernel.

      Returns Promise<void>

      A promise that resolves when the kernel has reconnected.

      This just refreshes the connection to an existing kernel, and does not perform an HTTP request to the server or restart the kernel.

    • Register a comm target handler.

      Parameters

      • _targetName: string
      • _callback: (comm: IComm, msg: ICommOpenMsg) => void | PromiseLike<void>

      Returns void

    • Register an IOPub message hook.

      Parameters

      • _msgId: string
      • _hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>

      Returns void

    • Remove a comm target handler.

      Parameters

      • _targetName: string
      • _callback: (comm: IComm, msg: ICommOpenMsg) => void | PromiseLike<void>

      Returns void

    • Remove an IOPub message hook.

      Parameters

      • _msgId: string
      • _hook: (msg: IIOPubMessage) => boolean | PromiseLike<boolean>

      Returns void

    • Send a comm_info_request message.

      Parameters

      • _content: {}

      Returns Promise<ICommInfoReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the comm_info_reply content when the shell reply is received and validated.

    • Send a complete_request message.

      Parameters

      • _content: {}

      Returns Promise<ICompleteReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the complete_reply content when the shell reply is received and validated.

    • Send a create_subshell_request message.

      https://github.com/jupyter/enhancement-proposals/pull/91

      Parameters

      • _content: Record<string, unknown>
      • Optional_disposeOnDone: boolean

      Returns IControlFuture<ICreateSubshellRequestMsg, ICreateSubshellReplyMsg>

      A promise that resolves with the response message.

    • Send a delete_subshell_request message.

      https://github.com/jupyter/enhancement-proposals/pull/91

      Parameters

      • _content: {}
      • Optional_disposeOnDone: boolean

      Returns IControlFuture<IDeleteSubshellRequestMsg, IDeleteSubshellReplyMsg>

      A promise that resolves with the response message.

    • Send an execute_request message.

      Parameters

      • content: {}

        The content of the request.

      • OptionaldisposeOnDone: boolean

        Whether to dispose of the future when done.

      • Optionalmetadata: unknown

      Returns IShellFuture<IExecuteRequestMsg, IExecuteReplyMsg>

      A kernel future.

      See Messaging in Jupyter.

      This method returns a kernel future, rather than a promise, since execution may have many response messages (for example, many iopub display messages).

      Future onReply is called with the execute_reply content when the shell reply is received and validated.

      See also: [[IExecuteReply]]

    • Send a history_request message.

      Parameters

      • _content: IHistoryRequestRange | IHistoryRequestSearch | IHistoryRequestTail

      Returns Promise<IHistoryReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the history_reply content when the shell reply is received and validated.

    • Send an inspect_request message.

      Parameters

      • _content: {}

      Returns Promise<IInspectReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the inspect_reply content when the shell reply is received and validated.

    • Send an is_complete_request message.

      Parameters

      • _content: {}

      Returns Promise<IIsCompleteReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the is_complete_response content when the shell reply is received and validated.

    • Send a kernel_info_request message.

      Returns Promise<IInfoReplyMsg>

      A promise that resolves with the response message.

      See Messaging in Jupyter.

      Fulfills with the kernel_info_response content when the shell reply is received and validated.

    • Send a list_subshell_request message.

      https://github.com/jupyter/enhancement-proposals/pull/91

      Parameters

      • _content: Record<string, unknown>
      • Optional_disposeOnDone: boolean

      Returns IControlFuture<IListSubshellRequestMsg, IListSubshellReplyMsg>

      A promise that resolves with the response message.

    • Restart a kernel.

      Returns Promise<void>

      A promise that resolves when the kernel has restarted.

      Uses the Jupyter Server API and validates the response model.

      Any existing Future or Comm objects are cleared.

      It is assumed that the API call does not mutate the kernel id or name.

      The promise will be rejected if the kernel status is 'dead' or if the request fails or the response is invalid.

    • Type Parameters

      • T extends ControlMessageType

      Parameters

      • msg: IControlMessage<T>
      • Optional_expectReply: boolean
      • Optional_disposeOnDone: boolean

      Returns IControlFuture<IControlMessage<T>, IControlMessage<ControlMessageType>>

    • Send an input_reply message.

      Parameters

      • _content: ReplyContent<IInputReply>
      • _parent_header: unknown

      Returns void

    • Send a shell message to the kernel.

      Type Parameters

      • T extends ShellMessageType

      Parameters

      • msg: IShellMessage<T>

        The fully-formed shell message to send.

      • Optional_expectReply: boolean
      • Optional_disposeOnDone: boolean

      Returns IShellFuture<IShellMessage<T>, IShellMessage<ShellMessageType>>

    • Shutdown a kernel.

      Returns Promise<void>

      A promise that resolves when the kernel has shut down.

      Uses the Jupyter Notebook API.

      On a valid response, closes the websocket, disposes of the kernel object, and fulfills the promise.

      The promise will be rejected if the kernel status is 'dead', the request fails, or the response is invalid.