-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests: Faster batches:: IT tests #5626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@irevoire I will need some help with this one. Am I correct ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I yeah I see the issue, these tests were a bit rushed it looks like.
The best solution IMO is to create a new method similar to this one:
meilisearch/crates/meilisearch/tests/common/mod.rs
Lines 26 to 35 in ea6bb4d
#[track_caller] | |
pub fn uid(&self) -> u64 { | |
if let Some(uid) = self["uid"].as_u64() { | |
uid | |
} else if let Some(uid) = self["taskUid"].as_u64() { | |
uid | |
} else { | |
panic!("Didn't find any task id in: {self}"); | |
} | |
} |
Except its batch_uid
and it retrieve the batchUid
field or panic.
Then the usage is that you must wait for the task to finish and once it's finished you can retrieve the associated batch with this new method from the task body
let (task, _status_code) = index.create(None).await; | ||
index.wait_task(task.uid()).await.succeeded(); | ||
let (_response, code) = index.get_batch(0).await; | ||
let (_response, code) = index.get_batch(task.uid() as u32).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let (_response, code) = index.get_batch(task.uid() as u32).await; | |
let (_response, code) = index.get_batch(task.batch_uid()).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm.
It seems the batch_uid
property is set only for status=processing
tasks:
meilisearch/crates/index-scheduler/src/queue/tasks.rs
Lines 525 to 528 in 5c14a25
if processing.contains(task.uid) { | |
Task { | |
status: Status::Processing, | |
batch_uid: Some(batch.uid), |
At the moment the new method fails with:
thread 'batches::test_summarized_document_addition_or_update' panicked at crates/meilisearch/tests/batches/mod.rs:276:43:
Didn't find any batch id in: {
"taskUid": 19,
"indexUid": "961f61b5-5ac7-4b03-adbd-5839519d886e",
"status": "enqueued",
"type": "documentAdditionOrUpdate",
"enqueuedAt": "[date]"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should also be set for all the finished tasks.
Basically, it should always be set except when the task is enqueued, iirc and that's why we have to wait for the task to finishes before calling this method
Use shared server + unique indices where possible Related-to: meilisearch#4840 Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
4d8e40d
to
9e31d6c
Compare
Pull Request
Related issue
#4840
What does this PR do?