devkit_ui.missions.yaml
Classes
|
Owns the mission list and its YAML persistence. |
- class devkit_ui.missions.yaml.MissionYamlStore(path: str, on_write_done: Callable[[str], None])[source]
Bases:
objectOwns the mission list and its YAML persistence.
After attach(node), the node exposes:
node.missions : tuple[dict, …] read-only snapshot node.missions_version : int bumps on every change node.mission_status : str last-action status
Mission record schema:
id: ‘MISSION_1’ (allocated, immutable) name: str (operator label; defaults to id) rows: list[str] (topo entry-node names) action: str (key in ACTIONS) action_params: dict (per-action parameter overrides) repeat_every_hours: int | None (None == one-shot) active: bool created_at: str (ISO 8601 UTC) last_run_at: str | None last_run_success: bool | None
- add(rows: list, action: str, action_params: dict | None = None, name: str = '', repeat_every_hours: int | None = None, active: bool = True) str | None[source]
Add a mission. Returns its allocated id, or None on failure. Status carries the reason either way.
- find(mid: str) dict | None[source]
Lock-free single-mission lookup by id. Returns the dict from the current snapshot — treat as read-only.
- find_by_name(name: str) dict | None[source]
Lock-free lookup by operator name. Returns the first match. Useful for collision checks before add() (e.g. the UI_RUN record the executor creates to anchor repeat intervals).
- property missions: tuple[dict, ...]