Skip to content

@graphty/graphty-element / session / RunsApi

Interface: RunsApi ​

Defined in: graphty-element/src/session/runs/types.ts:734

Starting runs, finding them, and taking them away.

Starting the same algorithm with the same parameters over the same scope returns the run that already exists rather than a second one, re-executing it in place if the data moved under it. Ids are therefore deterministic -- derived from the algorithm, the canonical parameters and the scope digest, never from an execution counter -- so that a saved layer, recipe or template resolves to the same run whatever order things happened to run in.

Properties ​

queue ​

readonly queue: readonly QueueEntry[]

Defined in: graphty-element/src/session/runs/types.ts:797

The runs waiting to start, in queue order.

Methods ​

batch() ​

batch(specs, options?): Run<BatchResult>

Defined in: graphty-element/src/session/runs/types.ts:756

Start several algorithms as one piece of work, with one progress stream and one cancel.

Parameters ​

specs ​

readonly RunSpec[]

What to run.

options? ​

RunOptions & object

The batch's label, and the ordinary run options.

Returns ​

Run<BatchResult>

A run over the batch, resolving to how each member turned out.


bindings() ​

bindings(id): readonly string[]

Defined in: graphty-element/src/session/runs/types.ts:784

Which style layers read a run.

Run-to-layer is many-to-many, so a layer reading two runs survives the removal of one.

Parameters ​

id ​

string

The run id.

Returns ​

readonly string[]

The layer ids.


get() ​

get(id): Run<RunResult> | undefined

Defined in: graphty-element/src/session/runs/types.ts:762

One run, by id.

Parameters ​

id ​

string

The run id.

Returns ​

Run<RunResult> | undefined

The run, or undefined when this session holds none with that id.


list() ​

list(): readonly Run<RunResult>[]

Defined in: graphty-element/src/session/runs/types.ts:767

Every run this session holds, finished or not.

Returns ​

readonly Run<RunResult>[]

The runs, in the order they were started.


painting() ​

painting(id): RunPainting | undefined

Defined in: graphty-element/src/session/runs/types.ts:795

What the element decided to paint when a run first completed: one outcome per style suggestion the run made.

Readable as soon as await run returns. A re-run keeps the first decision, because a re-run does not repaint. "added" means the layers went on the stack, not that they show: a layer added later may cover it, which styles.legend() shows.

Parameters ​

id ​

string

The run id.

Returns ​

RunPainting | undefined

The decision, or undefined when this session holds no run with that id.


remove() ​

remove(id): RunRemoval

Defined in: graphty-element/src/session/runs/types.ts:776

Remove a run and every style layer reading it.

This is the other delete verb: removing a LAYER takes away the picture and keeps the result, removing a RUN takes away the result and everything drawn from it.

Parameters ​

id ​

string

The run id.

Returns ​

RunRemoval

What went with it.


start() ​

start(algorithm, params?, options?): Run

Defined in: graphty-element/src/session/runs/types.ts:749

Start one algorithm.

The scope is resolved when the call is made, and again when the work starts: a set it names that is redefined while the run waits in the queue is run over as redefined, and the run records the revision it used (record.scope.set.revision).

Parameters ​

algorithm ​

AlgorithmKey

Which algorithm to run.

params? ​

Readonly<Record<string, unknown>>

Its parameters.

options? ​

StartOptions

The scope, the seed, the id and the rest.

Returns ​

Run

The run, which is awaitable and watchable straight away.

Throws ​

E_SCOPE_EMPTY when a scope other than "graph" or "visible" holds no nodes (a run that finds it empty only when its work starts fails with the same code); E_BAD_COMMAND for a malformed scope or a set id never issued.