Skip to main content

Module execution

Module execution 

Source
Expand description

A run of a plan as a stream of events, for any interface to show.

Execution::start runs a plan’s program in a pseudo-terminal and returns a handle with a bounded channel of ExecutionEvents. The handle is what an interface acts through: keyboard input, the terminal’s size, stopping the run and writing its history record. The events are what it shows: the run and each step starting and ending, the terminal’s output as it arrives, progress, warnings, and how the run ended, with its checks.

A consumer that falls behind never holds the run up. Output waits in the run’s transcript until the channel has room and then arrives in larger pieces, each saying where in the transcript it starts; the other events wait in order behind it. Nothing is dropped. A consumer that goes away (drops the receiver) leaves the run going and its record still written.

The order is the run’s: RunStarted first, a step’s StepStarted before its end, and Completed or Interrupted after the output that came before the program ended. Step events come from the program’s step file and output from the terminal, read side by side every few milliseconds, so a step’s first or last bytes can fall on the other side of its event. Output can follow the end when processes the run left behind still write.

Structs§

Execution
A running plan. Every method takes &self, and the handle can be shared between threads.
Options
How to start a run.
StepInfo
One step of the plan, as the events name it.

Enums§

ExecutionEvent
Something that happened in a run.
HistoryPlace
Where a run’s history record goes.

Constants§

DEFAULT_CAPACITY
How many events the channel holds before the rest wait for room.
OUTPUT_CHUNK
The most output one event carries.