Interface ISessionContext

A context object to manage a widget's kernel session connection.

The current session connection is .session, the current session's kernel connection is .session.kernel. For convenience, we proxy several kernel connection and session connection signals up to the session context so that you do not have to manage slots as sessions and kernels change. For example, to act on whatever the current kernel's iopubMessage signal is producing, connect to the session context .iopubMessage signal.

interface ISessionContext {
    connectionStatusChanged: ISignal<
        ISessionContext,
        Kernel.ConnectionStatus,
    >;
    disposed: ISignal<ISessionContext, void>;
    hasNoKernel: boolean;
    iopubMessage: ISignal<
        ISessionContext,
        KernelMessage.IMessage<KernelMessage.MessageType>,
    >;
    isDisposed: boolean;
    isReady: boolean;
    isRestarting: boolean;
    isTerminating: boolean;
    kernelChanged: ISignal<
        ISessionContext,
        IChangedArgs<
            null
            | Kernel.IKernelConnection,
            null | Kernel.IKernelConnection,
            "kernel",
        >,
    >;
    kernelDisplayName: string;
    kernelDisplayStatus: KernelDisplayStatus;
    kernelManager?: Kernel.IManager;
    kernelPreference: IKernelPreference;
    kernelPreferenceChanged: ISignal<
        ISessionContext,
        IChangedArgs<IKernelPreference, IKernelPreference, string>,
    >;
    name: string;
    path: string;
    pendingInput: boolean;
    prevKernelName: string;
    propertyChanged: ISignal<ISessionContext, "name" | "type" | "path">;
    ready: Promise<void>;
    session: null | Session.ISessionConnection;
    sessionChanged: ISignal<
        ISessionContext,
        IChangedArgs<
            null
            | Session.ISessionConnection,
            null | Session.ISessionConnection,
            "session",
        >,
    >;
    sessionManager: Session.IManager;
    specsManager: KernelSpec.IManager;
    statusChanged: ISignal<ISessionContext, Kernel.Status>;
    type: string;
    unhandledMessage: ISignal<
        ISessionContext,
        KernelMessage.IMessage<KernelMessage.MessageType>,
    >;
    changeKernel(
        options?: Partial<Kernel.IModel>,
    ): Promise<null | Kernel.IKernelConnection>;
    dispose(): void;
    initialize(): Promise<boolean>;
    restartKernel(): Promise<void>;
    shutdown(): Promise<void>;
    startKernel(): Promise<boolean>;
}

Hierarchy

Implemented by

Properties

connectionStatusChanged: ISignal<ISessionContext, Kernel.ConnectionStatus>

A signal emitted when the kernel connection status changes, proxied from the session connection.

disposed: ISignal<ISessionContext, void>

A signal emitted when the object is disposed.

hasNoKernel: boolean

Whether the kernel is "No Kernel" or not.

As the displayed name is translated, this can be used directly.

A signal emitted for a kernel messages, proxied from the session connection.

isDisposed: boolean

Test whether the object has been disposed.

This property is always safe to access.

isReady: boolean

Whether the session context is ready.

isRestarting: boolean

Whether the session context is restarting.

isTerminating: boolean

Whether the session context is terminating.

kernelChanged: ISignal<
    ISessionContext,
    IChangedArgs<
        null
        | Kernel.IKernelConnection,
        null | Kernel.IKernelConnection,
        "kernel",
    >,
>

A signal emitted when the kernel changes, proxied from the session connection.

kernelDisplayName: string

The sensible display name for the kernel, or translated "No Kernel"

This is at this level since the underlying kernel connection does not have access to the kernel spec manager.

kernelDisplayStatus: KernelDisplayStatus

A sensible status to display

This combines the status and connection status into a single status for the user.

kernelManager?: Kernel.IManager

The kernel manager

In the next major version of this interface, a kernel manager is required.

kernelPreference: IKernelPreference

The kernel preference for starting new kernels.

kernelPreferenceChanged: ISignal<
    ISessionContext,
    IChangedArgs<IKernelPreference, IKernelPreference, string>,
>

Signal emitted if the kernel preference changes.

name: string

The session name.

Typically .session.name should be used. This attribute is useful if there is no current session.

path: string

The session path.

Typically .session.path should be used. This attribute is useful if there is no current session.

pendingInput: boolean

A flag indicating if session is has pending input, proxied from the session connection.

prevKernelName: string

The previous kernel name.

propertyChanged: ISignal<ISessionContext, "name" | "type" | "path">

A signal emitted when a session property changes, proxied from the session connection.

ready: Promise<void>

A promise that is fulfilled when the session context is ready.

session: null | Session.ISessionConnection

The current session connection.

sessionChanged: ISignal<
    ISessionContext,
    IChangedArgs<
        null
        | Session.ISessionConnection,
        null | Session.ISessionConnection,
        "session",
    >,
>

A signal emitted when the session connection changes.

sessionManager: Session.IManager

The session manager used by the session.

specsManager: KernelSpec.IManager

The kernel spec manager

A signal emitted when the kernel status changes, proxied from the session connection.

type: string

The session type.

Typically .session.type should be used. This attribute is useful if there is no current session.

A signal emitted for an unhandled kernel message, proxied from the session connection.

Methods

  • 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