mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 04:36:32 +00:00
Merge pull request #5858 from shreeup/5835DispProgressTrace
Display the progressTrace in real time
This commit is contained in:
@ -284,6 +284,14 @@ impl BatchQueue {
|
|||||||
if Some(batch_id) == processing.batch.as_ref().map(|batch| batch.uid) {
|
if Some(batch_id) == processing.batch.as_ref().map(|batch| batch.uid) {
|
||||||
let mut batch = processing.batch.as_ref().unwrap().to_batch();
|
let mut batch = processing.batch.as_ref().unwrap().to_batch();
|
||||||
batch.progress = processing.get_progress_view();
|
batch.progress = processing.get_progress_view();
|
||||||
|
// Add progress_trace from the current progress state
|
||||||
|
if let Some(progress) = &processing.progress {
|
||||||
|
batch.stats.progress_trace = progress
|
||||||
|
.accumulated_durations()
|
||||||
|
.into_iter()
|
||||||
|
.map(|(k, v)| (k, v.into()))
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
Ok(batch)
|
Ok(batch)
|
||||||
} else {
|
} else {
|
||||||
self.get_batch(rtxn, batch_id)
|
self.get_batch(rtxn, batch_id)
|
||||||
|
@ -104,6 +104,15 @@ fn query_batches_simple() {
|
|||||||
batches[0].started_at = OffsetDateTime::UNIX_EPOCH;
|
batches[0].started_at = OffsetDateTime::UNIX_EPOCH;
|
||||||
assert!(batches[0].enqueued_at.is_some());
|
assert!(batches[0].enqueued_at.is_some());
|
||||||
batches[0].enqueued_at = None;
|
batches[0].enqueued_at = None;
|
||||||
|
|
||||||
|
if !batches[0].stats.progress_trace.is_empty() {
|
||||||
|
batches[0].stats.progress_trace.clear();
|
||||||
|
batches[0]
|
||||||
|
.stats
|
||||||
|
.progress_trace
|
||||||
|
.insert("processing tasks".to_string(), "deterministic_duration".into());
|
||||||
|
}
|
||||||
|
|
||||||
// Insta cannot snapshot our batches because the batch stats contains an enum as key: https://github.com/mitsuhiko/insta/issues/689
|
// Insta cannot snapshot our batches because the batch stats contains an enum as key: https://github.com/mitsuhiko/insta/issues/689
|
||||||
let batch = serde_json::to_string_pretty(&batches[0]).unwrap();
|
let batch = serde_json::to_string_pretty(&batches[0]).unwrap();
|
||||||
snapshot!(batch, @r###"
|
snapshot!(batch, @r###"
|
||||||
@ -122,6 +131,9 @@ fn query_batches_simple() {
|
|||||||
},
|
},
|
||||||
"indexUids": {
|
"indexUids": {
|
||||||
"catto": 1
|
"catto": 1
|
||||||
|
},
|
||||||
|
"progressTrace": {
|
||||||
|
"processing tasks": "deterministic_duration"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"startedAt": "1970-01-01T00:00:00Z",
|
"startedAt": "1970-01-01T00:00:00Z",
|
||||||
|
@ -2184,6 +2184,7 @@ async fn last_error_stats() {
|
|||||||
".progress" => "[ignored]",
|
".progress" => "[ignored]",
|
||||||
".stats.embedderRequests.total" => "[ignored]",
|
".stats.embedderRequests.total" => "[ignored]",
|
||||||
".stats.embedderRequests.failed" => "[ignored]",
|
".stats.embedderRequests.failed" => "[ignored]",
|
||||||
|
".stats.progressTrace" => "[ignored]",
|
||||||
".startedAt" => "[ignored]"
|
".startedAt" => "[ignored]"
|
||||||
}), @r#"
|
}), @r#"
|
||||||
{
|
{
|
||||||
@ -2204,6 +2205,7 @@ async fn last_error_stats() {
|
|||||||
"indexUids": {
|
"indexUids": {
|
||||||
"doggo": 1
|
"doggo": 1
|
||||||
},
|
},
|
||||||
|
"progressTrace": "[ignored]",
|
||||||
"embedderRequests": {
|
"embedderRequests": {
|
||||||
"total": "[ignored]",
|
"total": "[ignored]",
|
||||||
"failed": "[ignored]",
|
"failed": "[ignored]",
|
||||||
|
Reference in New Issue
Block a user