-
Notifications
You must be signed in to change notification settings - Fork 90
Redesign update API to task API #372
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
Conversation
fe1d47b
to
faf9e90
Compare
faf9e90
to
a1daa4e
Compare
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.
In addition to the review comments, a couple of additional comments.
In conftest.py
the clear_indexes
fixture can have race conditions now that the delete of indexes is async. To prevent this the deleting should wait for the task to complete.
@fixture(autouse=True)
def clear_indexes(client):
"""
Auto-clears the indexes after each test function run.
Makes all the test functions independent.
"""
# Yields back to the test function.
yield
# Deletes all the indexes in the MeiliSearch instance.
indexes = client.get_indexes()
for index in indexes:
result = client.index(index.uid).delete()
client.wait_for_task(result["uid"])
Just as a suggestion, the new task functionality, wait_for_task
, get_task
, and get_tasks
, could be their own functions outside of the Client
and Index
. This would prevent the need to have and maintain the same code in two different places.
c67afa0
to
0faa2e1
Compare
0faa2e1
to
6c2e832
Compare
Thank you so much for this review @sanders41! 🔥 |
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
Co-authored-by: cvermand <[email protected]>
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.
LGTM 🔥🔥🔥
bors merge |
372: Redesign update API to task API r=alallema a=alallema ### Breaking Changes All the actions on indexes are now asynchronous: - `create_index()`, `update_index()`, `delete_index()` return a `task` response instead of an `Index`. - `index.create` and `index.delete` from index return a `task`. - `wait_for_pending_update()` - is renamed into `wait_for_task` - the current `index.wait_for_task()` method call `/tasks/:uid` - `index.get_update_status` is renamed `index.get_task` - `index.get_all_update_status` is renamed `index.get_tasks` **Notes:** The only two methods that now return an `Index` are `client.index()` and `client.get_index()` ### Enhancements - new method `client.wait_for_task()` call `/tasks/:uid` - new method `client.get_tasks` that calls `/tasks` - new method `client.get_task` that calls `/tasks/:uid` ### Misc - `delete_if_exists` and `get_or_create_index` are commented since we don't know yet if we will remove them or not. Co-authored-by: alallema <[email protected]> Co-authored-by: Amélie <[email protected]>
Build failed: |
382: Addition related to API keys r=alallema a=alallema ### Breaking Changes Granular management of API keys is now added to MeiliSearch. New methods have been created to manage this: - `http.patch` use by `update_key` - `client.get_key` get information about a specific API key. - `client.create_key` create a new API key. - `client.delete_key` delete an API key. - `client.update_key` update an API key. Note: Thanks to `@sanders41` whose code is largely inspired by [his implementation](https://github.com/sanders41/meilisearch-python-async/blob/e44941b7bf5735c8e99f0a2a12b707db03ac048a/meilisearch_python_async/client.py#L298) and [here](#372 (comment)). Co-authored-by: alallema <[email protected]>
370: Changes related to the next MeiliSearch release (v0.25.0) r=alallema a=meili-bot Related to this issue: meilisearch/integration-guides#157 This PR: - gathers the changes related to the next MeiliSearch release (v0.25.0) so that this package is ready when the official release is out. - should pass the tests against the [latest pre-release of MeiliSearch](https://github.com/meilisearch/MeiliSearch/releases). - might eventually contain test failures until the MeiliSearch v0.25.0 is out.⚠️ This PR should NOT be merged until the next release of MeiliSearch (v0.25.0) is out. _This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/master/guides/pre-release-week.md) purpose._ Done: - #371 - #381 - #372 - #382 - #396 Co-authored-by: meili-bot <[email protected]> Co-authored-by: alallema <[email protected]> Co-authored-by: Amélie <[email protected]>
Breaking Changes
All the actions on indexes are now asynchronous:
create_index()
,update_index()
,delete_index()
return atask
response instead of anIndex
.index.create
andindex.delete
from index return atask
.wait_for_pending_update()
wait_for_task
index.wait_for_task()
method call/tasks/:uid
index.get_update_status
is renamedindex.get_task
index.get_all_update_status
is renamedindex.get_tasks
Notes: The only two methods that now return an
Index
areclient.index()
andclient.get_index()
Enhancements
client.wait_for_task()
call/tasks/:uid
client.get_tasks
that calls/tasks
client.get_task
that calls/tasks/:uid
Misc
delete_if_exists
andget_or_create_index
are commented since we don't know yet if we will remove them or not.