pinakes: import in parallel; various UI improvements
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1eb47cd79cd4145c56af966f6756fe1d6a6a6964
This commit is contained in:
parent
278bcaa4b0
commit
116fe7b059
42 changed files with 4316 additions and 316 deletions
|
|
@ -231,4 +231,41 @@ impl JobQueue {
|
|||
job.updated_at = Utc::now();
|
||||
}
|
||||
}
|
||||
|
||||
/// Get job queue statistics
|
||||
pub async fn stats(&self) -> JobQueueStats {
|
||||
let jobs = self.jobs.read().await;
|
||||
let mut pending = 0;
|
||||
let mut running = 0;
|
||||
let mut completed = 0;
|
||||
let mut failed = 0;
|
||||
|
||||
for job in jobs.values() {
|
||||
match job.status {
|
||||
JobStatus::Pending => pending += 1,
|
||||
JobStatus::Running { .. } => running += 1,
|
||||
JobStatus::Completed { .. } => completed += 1,
|
||||
JobStatus::Failed { .. } => failed += 1,
|
||||
JobStatus::Cancelled => {} // Don't count cancelled jobs
|
||||
}
|
||||
}
|
||||
|
||||
JobQueueStats {
|
||||
pending,
|
||||
running,
|
||||
completed,
|
||||
failed,
|
||||
total: jobs.len(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Statistics about the job queue
|
||||
#[derive(Debug, Clone, Default)]
|
||||
pub struct JobQueueStats {
|
||||
pub pending: usize,
|
||||
pub running: usize,
|
||||
pub completed: usize,
|
||||
pub failed: usize,
|
||||
pub total: usize,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue