Skip to main content

Module run

Module run 

Source
Expand description

astrs run — the single-process mode, and this binary’s flagship verb.

astrs run — the single-process mode: CLI embeds an in-process daemon (and no coordinator socket), runs the whole graph under one supervisor with the orphan guard (parent-pid + process-group kill). — blueprint §4.2

  manifest ─► build lines (§16 scrubbed env, unless --skip-build)
                   │
                   ▼
        astrs_daemon::run_dataflow_with   ← the embedded daemon
           │              │            │
           │              │            └── cancel  ◄── SIGINT / SIGTERM
           │              └── report sink ─────────► terminal log stream
           ▼
      DataflowResult ─► exit code (§17: "exit code = result severity")

§What this module does not do

It does not re-implement any part of the daemon. Building, spawning, supervising, the restart budgets, the SIGTERM→SIGKILL finish ladder and the orphan guard all live in astrs-daemon and are reached through one call to astrs_daemon::run_dataflow_with — the function that exists for exactly this caller. What is genuinely this module’s own is the terminal experience: turning the daemon’s upward event stream into readable, filtered, colored lines while the graph runs; translating two kinds of interrupt into the daemon’s own graceful-stop path; and turning a astrs_wire::DataflowResult into a process exit code.

§Ctrl-C

The first SIGINT (or SIGTERM) asks every node to stop, exactly as astrs stop would: the daemon’s finish grace runs, then its escalation ladder. The second abandons the wait after the grace elapses and reports the run as incomplete — a user pressing Ctrl-C twice wants their shell back, and the orphan guard (ASTRS_RUN_PARENT_PID, set for every child by the daemon) plus per-node process groups are what stop that from leaking processes.

Structs§

RunArgs
astrs run’s arguments, already parsed and resolved.
RunReport
What one astrs run did.

Constants§

ABANDON_AFTER
How long a second interrupt waits for the daemon’s own escalation ladder before the wait is abandoned.
EXIT_FAILED
The exit code for a run in which at least one node failed.
EXIT_INCOMPLETE
The exit code for a run that never reached a terminal state — the wait was abandoned (a second Ctrl-C) or the daemon returned a still-running result.
EXIT_OK
The exit code for a run that finished with every node healthy.

Functions§

run
Runs one dataflow to completion in this process, streaming its output to out.