Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • Listener
    • Jupita

Index

Constructors

constructor

  • new Jupita(servers?: Server[]): Jupita
  • Construct a Jupyter executor.

    New Jupyter execution contexts can be constructed using the language option which will search for a kernel with a matching lowercased language property:

    new JupyterContext({language:'r'})
    

    Alternatively, you can specify a kernel directly:

    new JupyterContext({kernel:'ir'})
    

    See https://github.com/jupyter/jupyter/wiki/Jupyter-kernels for a list of available Jupyter kernels.

    Parameters

    • servers: Server[] = ...

    Returns Jupita

Properties

config

config: any

connectionFile

connectionFile: any

errors

errors: CodeError[] = []

Readonly id

id: string

The unique id of this executor.

Used for better tracing and to avoid duplicate entries for an executor (e.g. due to having multiple servers and therefore multiple addresses)

ioSocket

ioSocket: any

kernelInfo

kernelInfo: any

kernels

kernels: any = {}

A map of the specifications of Jupyter kernels available on this machine.

Optional language

language: string

The language for the current session.

outputs

outputs: any[] = []

process

process: any

Optional requestId

requestId: string

requestIdle

requestIdle: boolean = false

requestReply

requestReply: boolean = false

Optional requestResolve

requestResolve: () => void

Type declaration

    • (): void
    • Returns void

Protected servers

servers: Server[]

Servers that will listen on behalf of this executor and pass on requests to it.

shellSocket

shellSocket: any

spec

spec: any

Readonly timelimit

timelimit: number

Maximum time that the process will run.

Readonly timeout

timeout: number

Seconds of inactivity after which the listener stops.

Methods

addresses

  • addresses(): Promise<Addresses>
  • implements

    Implements {@link Executor.addresses}.

    description

    Combines the server addresses for this executor into a single Addresses object.

    Returns Promise<Addresses>

begin

  • begin<Type>(node: Type, claims?: Claims): Promise<Type>
  • Begin running a Node.

    This method keeps a document "running", usually to allow it to react to changes within it. Compare this to execute() which will not wait and will simply execute all nodes in the document. The document will keep running until the end() method is called on it.

    Usually this method is called with a SoftwareSession as the node argument. However, it could also be called with another Node type, e.g. an Article, in which case the executor may begin it's session property, or default session if that property is missing.

    Type parameters

    • Type: Node

    Parameters

    • node: Type

      The node to run, usually but not necessarily, a SoftwareSession

    • Optional claims: Claims

      The Claims made for the call

    Returns Promise<Type>

    The node, with updated properties, after it has begun running

build

  • build<Type>(node: Type): Promise<Type>
  • Build a Node.

    Type parameters

    • Type: Node

    Parameters

    • node: Type

      The node to build

    Returns Promise<Type>

    The build node

call

  • call<Type>(method: Method, params: Params): Promise<Type>
  • A fallback implementation of one of the above methods.

    Since this base executor has no capabilities, this method simply throws a CapabilityError. Derived classes, may override this method, and /or one of the methods above.

    Provided so that derived classes such as Client, Delegator and Queuer can override a single method to provide their functionality instead of having to implement each of the above methods.

    Type parameters

    • Type

    Parameters

    • method: Method

      The name of the method

    • params: Params

      Values of parameters (i.e. arguments)

    Returns Promise<Type>

cancel

  • cancel(job: string): Promise<boolean>
  • Cancel a previous request to call a method

    Parameters

    • job: string

      The unique id of the request to be cancelled.

    Returns Promise<boolean>

    Whether or not the request was cancelled.

capabilities

  • capabilities(): Promise<Capabilities>
  • override

    Override of Executor.capabilities to define this interpreter's capabilities.

    Returns Promise<Capabilities>

compile

  • compile<Type>(node: Type): Promise<Type>
  • Compile a Node.

    Type parameters

    • Type: Node

    Parameters

    • node: Type

      The node to compile

    Returns Promise<Type>

    The compiled node

decode

  • decode(source: string, format?: string): Promise<Node>
  • Decode content to a Node.

    Parameters

    • source: string

      The source of the content to decode

    • Optional format: string

      The format of the content

    Returns Promise<Node>

    The decoded node

dispatch

  • dispatch(method: Method, params?: Params): Promise<any>
  • override

    Override of {@link Executor.dispatch} to update heartbeat with current time.

    Parameters

    • method: Method
    • Optional params: Params

    Returns Promise<any>

encode

  • encode(node: Node, dest?: string, format?: string): Promise<string>
  • Encode a Node in a format.

    Parameters

    • node: Node

      The node to encode

    • Optional dest: string

      The destination for the encoded content

    • Optional format: string

      The format to encode

    Returns Promise<string>

    The encoded content, or the destination of the content.

end

  • end<Type>(node: Type, claims?: Claims): Promise<Type>
  • End running a Node.

    Type parameters

    • Type: Node

    Parameters

    • node: Type

      The running node, usually but not necessarily, a SoftwareSession

    • Optional claims: Claims

      The Claims made for the call

    Returns Promise<Type>

    The node, with updated properties, after it has ended running

execute

  • execute<Type>(node: Type): Promise<Type>
  • override

    Override of Executor.execute that executes code in a Jupyter kernel.

    For cells with CodeExpression nodes utilizes user_expressions property of an execute_request to evaluate expression side-effect free.

    Type parameters

    • Type: Node

    Parameters

    • node: Type

    Returns Promise<Type>

Private findKernels

  • findKernels(): Promise<Record<string, any>>
  • Find Jupyter kernels that are installed on this machine.

    Returns Promise<Record<string, any>>

Private ioResponse

  • ioResponse(response: any): void

manifest

  • manifest(): Promise<Manifest>
  • Get the manifest of the executor.

    see

    {@link Capabilities}

    see

    {@link Addresses}

    Returns Promise<Manifest>

notified

  • notified(level: string, message: string, node?: Node): void
  • override

    Override of {@link Executor.notify} to update heartbeat with current time.

    Parameters

    • level: string
    • message: string
    • Optional node: Node

    Returns void

notify

  • notify(level: string, message: string, node?: Node, clients?: string[]): Promise<void>
  • implements

    {Executor.notify}

    Send a notification to clients via each of this executor's servers

    Parameters

    • level: string
    • message: string
    • Optional node: Node
    • Optional clients: string[]

    Returns Promise<void>

pipe

  • pipe(node: Node, calls: (Method | [Method, Params])[]): Promise<Node>
  • Call a pipeline of methods passing the result of each call as the first argument of the next call.

    This method is a "meta" method that is used to chain together calls to other methods. When using a remote executor, it is more efficient than chaining those calls together "by hand" because it only involves one round trip request to the executor.

    Parameters

    • node: Node

      The node to pipe through methods

    • calls: (Method | [Method, Params])[]

      A list of method, parameters tuples to pipe the node through

    Returns Promise<Node>

    The node after it has been piped through the methods

query

  • query(node: Node, query: string, lang: string): Promise<Node>
  • Query a Node.

    Currently allows for two query languages:

    Parameters

    • node: Node
    • query: string
    • lang: string

    Returns Promise<Node>

register

  • register(): Promise<string>
  • Register this listener so that it can be discovered by other executors.

    Returns Promise<string>

    The path to the registration file.

Private resolve

  • resolve(force?: boolean): void
  • Resolve a request if a reply has been received and state is idle.

    Parameters

    • force: boolean = false

    Returns void

run

  • run(): Promise<void>
  • Run this executor

    Starts listening with graceful shutdown on SIGINT or SIGTERM, and checking for timeout (if set).

    see

    {@link Server.run}

    Returns Promise<void>

Private shellRequest

  • shellRequest(type: string, content?: Record<string, any>, timeout?: number): Promise<void>

Private shellResponse

  • shellResponse(response: any): void
  • Receive a response message from the kernel on the shell channel.

    Parameters

    • response: any

      Response message

    Returns void

start

  • start(servers?: Server[]): Promise<void>
  • Start listening by starting all servers.

    Parameters

    • Optional servers: Server[]

      Any additional servers to start.

    Returns Promise<void>

Private startKernel

  • startKernel(language: string): Promise<void>
  • Start a Jupyter kernel.

    Parameters

    • language: string

    Returns Promise<void>

stop

  • stop(): Promise<void>
  • override

    Override of Listener.stop to stop the kernel as well as servers.

    Returns Promise<void>

unbundle

  • unbundle(bundle: Record<string, any>): Node

Generated using TypeDoc