Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add task cancel API for v0.30.0 #596

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

Merged
merged 10 commits into from
Nov 21, 2022

Conversation

alallema
Copy link
Contributor

@alallema alallema commented Nov 16, 2022

Add the cancel task API see spec

Enhancement

It is now possible to delete your tasks:

example:

    client.cancel_tasks({"status": "enqueued"})

TODO

  • Add canceled_by in Task class
  • Add error in Task class
  • Implement cancel_tasks()
    • params: parameters: dict[str, Any]
    • returns: TaskInfo
  • index_uid is now optional
  • Tests cancelation with query parameters
    • With uid
    • Cancel every task

@alallema alallema changed the base branch from main to bump-meilisearch-v0.30.0 November 16, 2022 09:40
@alallema alallema added the enhancement New feature or request label Nov 16, 2022
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from acb9cc5 to 3ead4e1 Compare November 16, 2022 09:48
@alallema alallema requested a review from bidoubiwa November 16, 2022 09:48
@alallema alallema force-pushed the bump-meilisearch-v0.30.0 branch from e5fd493 to 6dd53c9 Compare November 16, 2022 10:00
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch 2 times, most recently from cba795a to 57f3953 Compare November 16, 2022 11:42
@alallema alallema requested a review from bidoubiwa November 16, 2022 11:42
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from 57f3953 to 3f170d1 Compare November 16, 2022 13:29
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch 2 times, most recently from f13edf8 to fd481df Compare November 16, 2022 14:19
@alallema alallema force-pushed the bump-meilisearch-v0.30.0 branch from dee4333 to c54dbf0 Compare November 17, 2022 11:54
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from fd481df to b8a1aa1 Compare November 17, 2022 12:02
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch 2 times, most recently from 835f9d6 to b9af137 Compare November 17, 2022 15:11
@alallema alallema requested a review from bidoubiwa November 17, 2022 15:11
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from b9af137 to df03c15 Compare November 17, 2022 16:58
@alallema alallema requested a review from bidoubiwa November 17, 2022 16:59
@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from df03c15 to 010eb99 Compare November 18, 2022 08:40
@@ -11,7 +11,8 @@ class Task(CamelBase):
status: str
type: str
details: Dict[str, Any]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In another PR, this should be changed to Union[Dict[str, Any], None]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alallema alallema force-pushed the add_cancel_api_for_v0.30.0 branch from 714465a to 12569d9 Compare November 21, 2022 11:26
@alallema alallema requested a review from bidoubiwa November 21, 2022 11:26
@sanders41
Copy link
Collaborator

Hey @sanders41, I understand the need of your suggestion but the naming (I know this was just an example) makes it as much confusing.

What about creating a Task class with Static functions? My python is not the best, sorry if this is not a good practice/

That would work. There is also another option to keep it a function that would be simpler and require no change in the task module while still making things clear.

from meilisearch import task

def get_task(self, uid: int) -> Task:
    # ...
    task = task.get_task(x)

Copy link
Collaborator

@sanders41 sanders41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggestion is because I just ran into this issue updating the async python client. The current cancel task tests assume other tests have already run and generated tasks. On first starting the server, if a cancel task test is run first it will error because no tasks have been created yet. This fixture creates some tasks to prevent that.

Copy link
Contributor

@bidoubiwa bidoubiwa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🔥

@alallema alallema merged commit 753a826 into bump-meilisearch-v0.30.0 Nov 21, 2022
@alallema alallema deleted the add_cancel_api_for_v0.30.0 branch November 21, 2022 17:48
bors bot added a commit that referenced this pull request Nov 28, 2022
588: Changes related to the next Meilisearch release (v0.30.0) r=alallema a=meili-bot

Related to this issue: meilisearch/integration-guides#221

This PR:
- gathers the changes related to the next Meilisearch release (v0.30.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.30.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.30.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._

- #597 
- #595 
- #596 
- #598
- #603

Co-authored-by: meili-bot <[email protected]>
Co-authored-by: alallema <[email protected]>
Co-authored-by: Amélie <[email protected]>
bors bot added a commit that referenced this pull request Nov 28, 2022
588: Changes related to the next Meilisearch release (v0.30.0) r=alallema a=meili-bot

Related to this issue: meilisearch/integration-guides#221

This PR:
- gathers the changes related to the next Meilisearch release (v0.30.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.30.0 is out.

⚠️ This PR should NOT be merged until the next release of Meilisearch (v0.30.0) is out.

_This PR is auto-generated for the [pre-release week](https://github.com/meilisearch/integration-guides/blob/main/resources/pre-release-week.md) purpose._

- #597 
- #595 
- #596 
- #598
- #603

Co-authored-by: meili-bot <[email protected]>
Co-authored-by: alallema <[email protected]>
Co-authored-by: Amélie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants