(self)
| 1089 | conn.execute(insert(agent_runs).values(**values)) |
| 1090 | |
| 1091 | def load_watch_runtime(self) -> dict[str, Any]: |
| 1092 | with self.engine.connect() as conn: |
| 1093 | rows = conn.execute( |
| 1094 | select(agent_runs) |
| 1095 | .where(agent_runs.c.run_type == "watch_runtime") |
| 1096 | .where(agent_runs.c.status == "running") |
| 1097 | ).mappings() |
| 1098 | watches: dict[str, Any] = {} |
| 1099 | for row in rows: |
| 1100 | payload = _json_loads(row["metadata_json"], {}) |
| 1101 | watch_id = row["definition_id"] |
| 1102 | if watch_id: |
| 1103 | watches[str(watch_id)] = { |
| 1104 | "running": True, |
| 1105 | "pid": row["pid"], |
| 1106 | "started_at": row["started_at"], |
| 1107 | "updated_at": row["updated_at"], |
| 1108 | } | (payload if isinstance(payload, dict) else {}) |
| 1109 | return {"watches": watches} |
| 1110 | |
| 1111 | def _scheduled_task_values(self, payload: dict[str, Any]) -> dict[str, Any]: |
| 1112 | return { |
no test coverage detected