Constructors

Properties

_executed: PromiseDelegate<IOutputAreaModel>
_executionPhaseChanged: Signal<KernelExecutor, IExecutionPhaseOutput> = ...
_future?: IFuture<IExecuteRequestMsg, IExecuteReplyMsg>
_kernelConnection: IKernelConnection
_kernelState: KernelsState
_model: IOutputAreaModel
_modelChanged: Signal<KernelExecutor, IOutputAreaModel> = ...
_onExecutionPhaseChanged?: ((phaseOutput) => void)

Type declaration

_outputs: IOutput[]
_outputsChanged: Signal<KernelExecutor, IOutput[]> = ...
_phaseChangeCallback?: ((source, phaseOutput) => void)

Type declaration

_shellMessageHooks: ShellMessageHook[] = ...
_stopOnError: boolean
_suppressCodeExecutionErrors: boolean = false

Accessors

Methods

  • Execute a code snippet.

    Parameters

    • code: string

      Code to be executed

    • options: {
          allowStdin?: boolean;
          iopubMessageHooks?: IOPubMessageHook[];
          shellMessageHooks?: ShellMessageHook[];
          silent?: boolean;
          stopOnError?: boolean;
          storeHistory?: boolean;
          suppressCodeExecutionErrors?: boolean;
      } = {}

      Callbacks on IOPub messages and on reply message

      • Optional allowStdin?: boolean
      • Optional iopubMessageHooks?: IOPubMessageHook[]
      • Optional shellMessageHooks?: ShellMessageHook[]
      • Optional silent?: boolean
      • Optional stopOnError?: boolean
      • Optional storeHistory?: boolean
      • Optional suppressCodeExecutionErrors?: boolean

    Returns Promise<IOutputAreaModel>

    The outputs model

    Example

    Here is an example to execute the code snippet print('hello').

    const executor = new KernelExecutor(kernelConnection);
    const outputs = await executor.execute("print('hello')");