(runs: AutonomyRunRecord[])
| 1103 | } |
| 1104 | |
| 1105 | export function formatAutonomyRunsStatus(runs: AutonomyRunRecord[]): string { |
| 1106 | const counts = { |
| 1107 | queued: 0, |
| 1108 | running: 0, |
| 1109 | completed: 0, |
| 1110 | failed: 0, |
| 1111 | cancelled: 0, |
| 1112 | } |
| 1113 | for (const run of runs) { |
| 1114 | counts[run.status] += 1 |
| 1115 | } |
| 1116 | const latest = runs[0] |
| 1117 | const latestLine = latest |
| 1118 | ? `Latest: ${latest.trigger} ${latest.status} (${new Date(latest.createdAt).toLocaleString()})` |
| 1119 | : 'Latest: none' |
| 1120 | return [ |
| 1121 | `Autonomy runs: ${runs.length}`, |
| 1122 | `Queued: ${counts.queued}`, |
| 1123 | `Running: ${counts.running}`, |
| 1124 | `Completed: ${counts.completed}`, |
| 1125 | `Failed: ${counts.failed}`, |
| 1126 | `Cancelled: ${counts.cancelled}`, |
| 1127 | latestLine, |
| 1128 | ].join('\n') |
| 1129 | } |
| 1130 | |
| 1131 | export function formatAutonomyRunsList( |
| 1132 | runs: AutonomyRunRecord[], |
no outgoing calls
no test coverage detected