Interface ISessionContext

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

Notes

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 | IKernelConnection, null | IKernelConnection, "kernel">>;
    kernelDisplayName: string;
    kernelDisplayStatus: KernelDisplayStatus;
    kernelPreference: IKernelPreference;
    kernelPreferenceChanged: ISignal<ISessionContext, IChangedArgs<IKernelPreference, IKernelPreference, string>>;
    name: string;
    path: string;
    pendingInput: boolean;
    prevKernelName: string;
    propertyChanged: ISignal<ISessionContext, "type" | "name" | "path">;
    ready: Promise<void>;
    session: null | ISessionConnection;
    sessionChanged: ISignal<ISessionContext, IChangedArgs<null | ISessionConnection, null | ISessionConnection, "session">>;
    sessionManager: Session.IManager;
    specsManager: KernelSpec.IManager;
    statusChanged: ISignal<ISessionContext, Status>;
    type: string;
    unhandledMessage: ISignal<ISessionContext, KernelMessage.IMessage<KernelMessage.MessageType>>;
    changeKernel(options?): Promise<null | 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.

Notes

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.

Notes

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 | IKernelConnection, null | 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"

Notes

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

Notes

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

kernelPreference: IKernelPreference

The kernel preference for starting new kernels.

Signal emitted if the kernel preference changes.

name: string

The session name.

Notes

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

path: string

The session path.

Notes

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, "type" | "name" | "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 | ISessionConnection

The current session connection.

sessionChanged: ISignal<ISessionContext, IChangedArgs<null | ISessionConnection, null | 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

statusChanged: ISignal<ISessionContext, Status>

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

type: string

The session type.

Notes

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.

    Notes

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

    Undefined Behavior

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

    Returns void