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

    Inline Pyodide kernel that creates Web Worker from Blob URL

    Implements

    • IKernelConnection
    Index

    Constructors

    Properties

    _anyMessage: Signal<PyodideInlineKernel, IAnyMessageArgs> = ...
    _connectionStatus: ConnectionStatus = "connected"
    _connectionStatusChanged: Signal<PyodideInlineKernel, ConnectionStatus> = ...
    _currentExecuteCode: string
    _currentExecuteHeader: ExecuteRequestHeader
    _disposed: Signal<PyodideInlineKernel, void> = ...
    _executionCount: number = 0
    _executionCounts: Map<number, number> = ...
    _executionHeaders: Map<number, ExecuteRequestHeader> = ...
    _iopubMessage: Signal<PyodideInlineKernel, IAnyMessageArgs> = ...
    _messageId: number = 0
    _pendingInput: Signal<PyodideInlineKernel, boolean> = ...
    _status: Status = "idle"
    _statusChanged: Signal<PyodideInlineKernel, Status> = ...
    _unhandledMessage: Signal<PyodideInlineKernel, IMessage<MessageType>> = ...
    _worker: Worker
    clientId: string

    The client unique id.

    This should be unique for a particular kernel connection object.

    handleComms: boolean = true

    Whether the kernel connection handles comm messages.

    The comm message protocol currently has implicit assumptions that only one kernel connection is handling comm messages. This option allows a kernel connection to opt out of handling comms.

    See https://github.com/jupyter/jupyter_client/issues/263

    id: string

    The id of the server-side kernel.

    model: IModel

    The kernel model, for convenience.

    name: string

    The name of the server-side kernel.

    serverSettings: ISettings

    The server settings for the kernel.

    subshellId: string = null

    The subshell ID, main shell has null.

    username: string = ""

    The client username.

    Accessors

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

      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, any>

    • get connectionStatus(): ConnectionStatus

      The current connection status of the kernel.

      Returns ConnectionStatus

    • 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<any>

      The kernel info

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

      Returns Promise<any>

    • get iopubMessage(): ISignal<this, any>

      A signal emitted after an iopub kernel message is handled.

      Returns ISignal<this, any>

    • 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<any>

      Get the kernel spec.

      Returns Promise<any>

      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: any

      Returns IKernelConnection

    • Create a new comm.

      Parameters

      • _targetName: string
      • Optional_commId: string

      Returns any

      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

        The name of the comm target.

      • _callback: (comm: any, msg: any) => void | PromiseLike<void>

      Returns void

    • Register an IOPub message hook.

      Parameters

      • msgId: string

        The parent_header message id in messages the hook should intercept.

      • _hook: (msg: any) => boolean | PromiseLike<boolean>

      Returns void

    • Remove a comm target handler.

      Parameters

      • targetName: string

        The name of the comm target to remove.

      • _callback: (comm: any, msg: any) => void | PromiseLike<void>

      Returns void

    • Remove an IOPub message hook.

      Parameters

      • msgId: string

        The parent_header message id the hook intercepted.

      • _hook: (msg: any) => boolean | PromiseLike<boolean>

      Returns void

    • Send a comm_info_request message.

      Parameters

      • _content: any

      Returns Promise<any>

      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: any

        The content of the request.

      Returns Promise<any>

      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 an execute_request message.

      Parameters

      • content: any

        The content of the request.

      • Optional_disposeOnDone: boolean
      • Optional_metadata: any

      Returns any

      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: any

      Returns Promise<any>

      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: any

      Returns Promise<any>

      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: any

      Returns Promise<any>

      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<any>

      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.

    • 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 any

    • Send a shell message to the kernel.

      Parameters

      • _msg: any
      • Optional_expectReply: boolean
      • Optional_disposeOnDone: boolean

      Returns any

    • 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.