nustack

kernel

Kernel records: plane runs, their cell runs, the workers they run on, and what is live.

Module nuspace.shapes.kernel.

Kernel records: plane runs, their cell runs, the workers they run on, and what is live.

No status anywhere. A record logs intents (*_requested, written by ops) and effects (started_at, terminated_at, exit, error, written by the kernel and the backends). Whether something is live is whether its id is in an index: running for plane runs, cells_running for a plane run's cell runs, workers_running for workers. Ending is a write of terminated_at plus a delete from the index. Nothing moves, nothing is pruned, and nothing iterates runs or workers whole.

An index has narrower copies, one per owner, written in the same commit as the index itself: a plane's live runs (planes_running), a run's live workers (Run.workers_running). What is live of one plane or one run is read in the time of that, never of everything live.

NameCallMeaning
CellRunOne execution of one cell, inside a plane run. Never mutated into another.
KernelEverything the kernel and the backends record.
PlaneRunsOne plane's live plane runs: the ids in running whose run is of it.
RunOne execution of a plane: the thing started, stopped and killed.
WorkerThe executor unit a backend runs cells on: a process today, anything later.

CellRun

One execution of one cell, inside a plane run. Never mutated into another.

Path nuspace.shapes.CellRun.

A reload or a restart is a new cell run. version is the cell's version when this run was asked for, so a newer prog is told apart without reading source. by says who asked. worker is the id of the Worker its backend put it on.

out is [ts, stream, text] entries, a capped ring written whole by the run's own body.

Slots

NameKindTypeConfigPath
cellrefStrRefnuspace.shapes.CellRun.cell
versionrefIntRefnuspace.shapes.CellRun.version
byrefStrRefnuspace.shapes.CellRun.by
workerrefStrRefnuspace.shapes.CellRun.worker
started_atrefFloatRefnuspace.shapes.CellRun.started_at
interrupt_requestedrefBoolRefnuspace.shapes.CellRun.interrupt_requested
terminated_atrefFloatRefnuspace.shapes.CellRun.terminated_at
exitrefStrRefnuspace.shapes.CellRun.exit
errorrefStrRefnuspace.shapes.CellRun.error
outrefPrimitiveListRefnuspace.shapes.CellRun.out

Undocumented: example.

Kernel

Everything the kernel and the backends record.

Path nuspace.shapes.Kernel.

runs and workers are the source of truth, every one ever. running and workers_running are the live ids, so what is live is read in the time of what is live. planes_running is running by plane: a plane is listed while it has a live run, and only then.

Slots

NameKindTypeConfigPath
runsrefDictRef[str, Run]nuspace.shapes.Kernel.runs
runningrefSetRef[str]nuspace.shapes.Kernel.running
workersrefDictRef[str, Worker]nuspace.shapes.Kernel.workers
workers_runningrefSetRef[str]nuspace.shapes.Kernel.workers_running
planes_runningrefDictRef[str, PlaneRuns]nuspace.shapes.Kernel.planes_running

Undocumented: example.

PlaneRuns

One plane's live plane runs: the ids in running whose run is of it.

Path nuspace.shapes.PlaneRuns.

Slots

NameKindTypeConfigPath
runsrefSetRef[str]nuspace.shapes.PlaneRuns.runs

Undocumented: example.

Run

One execution of a plane: the thing started, stopped and killed.

Path nuspace.shapes.Run.

backend is the plane's backend when the run was asked for. envs is the env specs its cells run inside, each [name, *args] naming a factory registered at open: stored rather than the envs themselves because a function cannot be stored, and so anyone can run the plane the same way again.

cells is every cell run it ever had, cells_running the live ones. latest maps each cell to its newest cell run, written with it, so a cell's current run is a point read and never a walk of cells, which grows with every reload. The run ends once cells_running is empty, or on kill, its exit read off latest. workers is every worker its backend ever gave it, workers_running the live ones.

Slots

NameKindTypeConfigPath
planerefStrRefnuspace.shapes.Run.plane
backendrefStrRefnuspace.shapes.Run.backend
byrefStrRefnuspace.shapes.Run.by
envsrefPrimitiveListRefnuspace.shapes.Run.envs
started_atrefFloatRefnuspace.shapes.Run.started_at
termination_requestedrefBoolRefnuspace.shapes.Run.termination_requested
terminated_atrefFloatRefnuspace.shapes.Run.terminated_at
exitrefStrRefnuspace.shapes.Run.exit
errorrefStrRefnuspace.shapes.Run.error
cellsrefDictRef[str, CellRun]nuspace.shapes.Run.cells
cells_runningrefSetRef[str]nuspace.shapes.Run.cells_running
latestrefDictRef[str, str]nuspace.shapes.Run.latest
workersrefSetRef[str]nuspace.shapes.Run.workers
workers_runningrefSetRef[str]nuspace.shapes.Run.workers_running

Undocumented: example.

Worker

The executor unit a backend runs cells on: a process today, anything later.

Path nuspace.shapes.Worker.

Written by its backend only, read by everybody. run is the plane run it belongs to. handle is the backend's own address for it, a str only the backend reads (the pool's id, for the process backends). exit is ok when its backend let it go, killed when the plane run was killed, failed when it died by itself (error says how).

Slots

NameKindTypeConfigPath
backendrefStrRefnuspace.shapes.Worker.backend
runrefStrRefnuspace.shapes.Worker.run
handlerefStrRefnuspace.shapes.Worker.handle
started_atrefFloatRefnuspace.shapes.Worker.started_at
terminated_atrefFloatRefnuspace.shapes.Worker.terminated_at
exitrefStrRefnuspace.shapes.Worker.exit
errorrefStrRefnuspace.shapes.Worker.error

Undocumented: example.

On this page