Mondaic

salvus.flow.acta.observability.progress

salvus.flow.acta.observability.progress salvus flow acta observability progress

Live and recorded task progress from ledger events.

Terminals display a redrawn task tree; other streams get one line per event. Redraws are rate limited, and rendering failures warn once.

Functions

attempt_views()

def attempt_views(events: Sequence[Event]) -> list[AttemptView]: ...

Fold a run’s events into one view per attempt, in first-seen order.

Parameters
  • events Sequence[Event] — The run’s events, in seq order.
Returns list[AttemptView]

depths()

def depths(attempts: Sequence[AttemptView]) -> list[int]: ...

Return each attempt’s nesting depth, from the parent edge.

Parameters
  • attempts Sequence[AttemptView] — The attempts, in first-seen order.
Returns list[int]

render_run()

def render_run(run: Run, events: Sequence[Event]) -> str: ...

Render one run’s attempts as an indented tree.

Each attempt displays its last recorded status, including unfinished runs.

Parameters
  • run Run — The run to render.
  • events Sequence[Event] — Its events, in seq order.
Returns str — The lines to print, newline-joined.

render_runs()

def render_runs(runs: Sequence[Run]) -> str: ...

Render a run listing.

Parameters
  • runs Sequence[Run] — The runs to render, newest first.
Returns str — The lines to print, newline-joined.

render_tree()

def render_tree(
    attempts: Sequence[AttemptView], show_detail: bool = True
) -> str: ...

Render attempts as an indented tree.

Parameters
  • attempts Sequence[AttemptView] — The attempts, in first-seen order.
  • show_detail bool — Whether to print the first line of a failure’s detail beneath it.
Returns str — The lines, newline-joined; empty for no attempts.

Classes

AttemptView

class AttemptView(builtins.object):
    def __init__(
        self,
        task: str,
        key: str | None,
        parent_key: str | None,
        status: EventKind,
        detail: str,
        started_at: str,
        updated_at: str,
    ) -> None: ...

Task-attempt status derived from its events.

Parameters
  • task str — The task name.
  • key str | None — Its envelope key, once known.
  • parent_key str | None — The key of the task that called it, or None at the top level.
  • status EventKind — The last kind recorded for it.
  • detail str — Last event’s detail, or an empty string.
  • started_at str — ISO-8601 stamp of its first event.
  • updated_at str — ISO-8601 stamp of its last.
Attributes
elapsed_seconds float

Return how long this attempt has been running, in seconds.

ProgressView

class ProgressView(builtins.object):
    def __init__(
        self, stream: TextIO, clock: Callable[[], float] = time.monotonic
    ) -> None: ...

A tree of the current run’s attempts, redrawn as events arrive.

Parameters
  • stream TextIO — Where to draw. A stream whose isatty() is false gets one plain line per event instead of a redraw.
  • clock Callable[[], float] — Callable returning monotonic seconds for redraw rate limiting.
Methods
attempts()
def attempts(self) -> list[AttemptView]: ...

Return the run’s attempts so far, folded from its events.

Returns list[AttemptView]
close()
def close(self) -> None: ...

Draw the final state without rate limiting.

Returns None
handle()
def handle(self, event: Event) -> None: ...

Accept one event and redraw, subject to the rate limit.

Parameters
  • event Event — The event as written to the ledger.
Returns None
render()
def render(self) -> str: ...

Return the tree as it currently stands.

Returns str