Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DefaultSession

Session object for accessing the session REST api. The session should be used to start kernels and then shut them down -- for all other operations, the kernel object should be used. The namespace for DefaultSession statics.

Hierarchy

  • DefaultSession

Implements

Index

Constructors

constructor

Properties

Private _anyMessage

_anyMessage: Signal<this, IAnyMessageArgs> = new Signal<this, Kernel.IAnyMessageArgs>(this)

Private _id

_id: string = ""

Private _iopubMessage

_iopubMessage: Signal<this, IIOPubMessage<"clear_output" | "comm_close" | "comm_msg" | "comm_open" | "display_data" | "error" | "execute_input" | "execute_result" | "status" | "stream" | "update_display_data">> = new Signal<this, KernelMessage.IIOPubMessage>(this)

Private _isDisposed

_isDisposed: boolean = false

Private _kernel

_kernel: IKernel

Private _kernelChanged

_kernelChanged: Signal<this, IKernelChangedArgs> = new Signal<this, Session.IKernelChangedArgs>(this)

Private _name

_name: string = ""

Private _path

_path: string = ""

Private _propertyChanged

_propertyChanged: Signal<this, "path" | "name" | "type"> = new Signal<this, 'path' | 'name' | 'type'>(this)

Private _statusChanged

_statusChanged: Signal<this, "unknown" | "starting" | "reconnecting" | "idle" | "busy" | "restarting" | "autorestarting" | "dead" | "connected"> = new Signal<this, Kernel.Status>(this)

Private _terminated

_terminated: Signal<this, void> = new Signal<this, void>(this)

Private _type

_type: string = ""

Private _unhandledMessage

_unhandledMessage: Signal<this, IMessage<"clear_output" | "comm_close" | "comm_msg" | "comm_open" | "display_data" | "error" | "execute_input" | "execute_result" | "status" | "stream" | "update_display_data" | "comm_info_reply" | "comm_info_request" | "complete_reply" | "complete_request" | "execute_reply" | "execute_request" | "history_reply" | "history_request" | "inspect_reply" | "inspect_request" | "interrupt_reply" | "interrupt_request" | "is_complete_reply" | "is_complete_request" | "kernel_info_reply" | "kernel_info_request" | "shutdown_reply" | "shutdown_request" | "input_request" | "input_reply">> = new Signal<this, KernelMessage.IMessage>(this)

Private _updating

_updating: boolean = false

serverSettings

serverSettings: ISettings

The server settings of the session.

Accessors

anyMessage

  • A signal emitted for any kernel message.

    Note: The behavior is undefined if the message is modified during message handling. As such, it should be treated as read-only.

    Returns ISignal<this, IAnyMessageArgs>

id

  • get id(): string

iopubMessage

isDisposed

  • get isDisposed(): boolean

kernel

kernelChanged

model

name

  • get name(): string

path

  • get path(): string

propertyChanged

  • get propertyChanged(): ISignal<this, "path" | "name" | "type">
  • A signal emitted when a session property changes.

    Returns ISignal<this, "path" | "name" | "type">

status

statusChanged

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

terminated

  • get terminated(): ISignal<this, void>
  • A signal emitted when the session is shut down.

    Returns ISignal<this, void>

type

  • get type(): string

unhandledMessage

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

Methods

Private _handleModelChange

  • _handleModelChange(oldModel: IModel): void

Private _patch

  • _patch(body: string): Promise<IModel>
  • Send a PATCH to the server, updating the session path or the kernel.

    Parameters

    • body: string

    Returns Promise<IModel>

changeKernel

  • Change the kernel.

    params

    options - The name or id of the new kernel.

    Notes

    This shuts down the existing kernel and creates a new kernel, keeping the existing session ID and session path.

    Parameters

    Returns Promise<IKernelConnection>

clone

dispose

  • dispose(): void

Protected onAnyMessage

Protected onIOPubMessage

Protected onKernelStatus

Protected onUnhandledMessage

setName

  • setName(name: string): Promise<void>

setPath

  • setPath(path: string): Promise<void>
  • Change the session path.

    Parameters

    • path: string

      The new session path.

    Returns Promise<void>

    A promise that resolves when the session has renamed.

    Notes

    This uses the Jupyter REST API, and the response is validated. The promise is fulfilled on a valid response and rejected otherwise.

setType

  • setType(type: string): Promise<void>

Protected setupKernel

  • setupKernel(model: IModel): void
  • Create a new kernel connection and hook up to its events.

    Notes

    This method is not meant to be subclassed.

    Parameters

    Returns void

shutdown

  • shutdown(): Promise<void>
  • Kill the kernel and shutdown the session.

    Returns Promise<void>

    • The promise fulfilled on a valid response from the server.

    Notes

    Uses the Jupyter Notebook API, and validates the response. Disposes of the session and emits a [sessionDied] signal on success.

update

Static connectTo

Static findById

Static findByPath

Static listRunning

Static shutdown

  • shutdown(id: string, settings?: ISettings): Promise<void>

Static shutdownAll

  • shutdownAll(settings?: ISettings): Promise<void>
  • Shut down all sessions.

    Parameters

    • Optional settings: ISettings

      The server settings to use.

    Returns Promise<void>

    A promise that resolves when all the sessions are shut down.

Static startNew

Generated using TypeDoc