| 180 | } |
| 181 | |
| 182 | pub async fn mark_failed(&self, run_id: &str, error: impl Into<String>) -> Option<RunSnapshot> { |
| 183 | let mut runs = self.runs.write().await; |
| 184 | let run = runs.get_mut(run_id)?; |
| 185 | if run.status == RunStatus::Cancelled { |
| 186 | return Some(run.clone()); |
| 187 | } |
| 188 | run.status = RunStatus::Failed; |
| 189 | run.error = Some(error.into()); |
| 190 | run.updated_at_ms = now_ms(); |
| 191 | Some(run.clone()) |
| 192 | } |
| 193 | |
| 194 | pub async fn mark_cancelled(&self, run_id: &str) -> Option<RunSnapshot> { |
| 195 | let mut runs = self.runs.write().await; |