Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Tasks API - Add task cancelation capability #195

Merged
merged 77 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
a37c3a3
Add cancel to task spec
alallema Oct 25, 2022
afc62a8
Remove missing error
alallema Oct 25, 2022
7f5435d
Fix typo on cancels
alallema Oct 25, 2022
a6f7d8f
Fix IndexUid always null
alallema Oct 26, 2022
ec98300
Update text/0060-tasks-api.md
alallema Oct 26, 2022
c0b651e
Update text/0060-tasks-api.md
alallema Oct 26, 2022
b83508f
Update text/0060-tasks-api.md
alallema Oct 26, 2022
29fe887
Update text/0060-tasks-api.md
alallema Oct 26, 2022
bbe0d4b
Update text/0060-tasks-api.md
alallema Oct 26, 2022
6b7c70e
Update text/0060-tasks-api.md
alallema Oct 26, 2022
44a59b3
Update text/0060-tasks-api.md
alallema Oct 26, 2022
5c94d5e
Update text/0060-tasks-api.md
alallema Oct 26, 2022
5326363
Update text/0060-tasks-api.md
alallema Oct 26, 2022
dfcf97f
Add canceledBy and missing_filters error
alallema Oct 26, 2022
376b013
Merge 11.1 filter iwth get and 11.2 filter with post
alallema Oct 26, 2022
c737c95
Specified every date filter
alallema Oct 26, 2022
168aee8
Change uid as integer and not as string
alallema Oct 26, 2022
fa84b90
Add auto-batching and error
alallema Oct 26, 2022
773acc9
Add new route task/cancel api-key
alallema Oct 26, 2022
5c7fa20
Add global task note
alallema Oct 26, 2022
de5388d
Update text/0060-tasks-api.md
alallema Oct 27, 2022
a181465
Update text/0060-tasks-api.md
alallema Oct 27, 2022
6ade973
Update text/0060-tasks-api.md
alallema Oct 27, 2022
fc5386f
Update text/0060-tasks-api.md
alallema Oct 27, 2022
b9fcc75
Update text/0060-tasks-api.md
alallema Oct 27, 2022
fcbc344
Update text/0060-tasks-api.md
alallema Oct 27, 2022
00ffee1
Update text/0060-tasks-api.md
alallema Oct 27, 2022
7bdac55
Update text/0060-tasks-api.md
alallema Oct 27, 2022
817ad82
Update text/0060-tasks-api.md
alallema Oct 27, 2022
1ddb802
Update text/0060-tasks-api.md
alallema Oct 27, 2022
0d7c782
Update text/0060-tasks-api.md
alallema Oct 27, 2022
b38fffe
Update text/0060-tasks-api.md
alallema Oct 27, 2022
f766bc5
Update text/0060-tasks-api.md
alallema Oct 27, 2022
a613c43
Update text/0060-tasks-api.md
alallema Oct 27, 2022
69c6451
Update text/0060-tasks-api.md
alallema Oct 27, 2022
f0a86be
Update text/0060-tasks-api.md
alallema Oct 27, 2022
dedf5b5
Update text/0060-tasks-api.md
alallema Oct 27, 2022
e7924a7
Update text/0060-tasks-api.md
alallema Oct 27, 2022
1f5f38b
Update text/0060-tasks-api.md
alallema Oct 27, 2022
d5dc590
Update text/0060-tasks-api.md
alallema Oct 27, 2022
cf055af
Update text/0060-tasks-api.md
alallema Oct 27, 2022
7320ce1
Update text/0060-tasks-api.md
alallema Oct 27, 2022
d87cc96
Update text/0061-error-format-and-definitions.md
alallema Oct 27, 2022
4f5502f
Modification due to review
alallema Oct 27, 2022
809ccb5
Modification due to review
alallema Oct 27, 2022
3be2aeb
Modification due to review
alallema Oct 27, 2022
0578265
Modification due to review
alallema Oct 27, 2022
e584dec
Fix global task link
alallema Oct 27, 2022
7d445be
Fix format link
alallema Oct 27, 2022
178c051
Add open-api modification
alallema Oct 27, 2022
933ed5b
Remove trailing space
alallema Oct 27, 2022
fa33ffc
Add clarification
gmourier Nov 2, 2022
1af2b07
Add errors definition
gmourier Nov 2, 2022
e0671d7
Update open-api.yml
gmourier Nov 2, 2022
a9dfcea
fix task uid query parameter name
gmourier Nov 2, 2022
e8b34ed
Fix collission between url path and query parameters
gmourier Nov 2, 2022
9056f3f
fmt open-api.yml
gmourier Nov 2, 2022
b4d3f75
Add telemetry details
gmourier Nov 2, 2022
aa6f9d7
Add 202_taskCancelation example
gmourier Nov 2, 2022
65dbac4
Update originalQuery to originalFilters and update missing_task_filte…
gmourier Nov 3, 2022
ae44e18
matchedTasks is computed when the task is enqueued
gmourier Nov 3, 2022
7b3734f
Apply suggestions from code review
gmourier Nov 3, 2022
6d8ee3a
Apply suggestions from code review
gmourier Nov 3, 2022
9859dc6
Recall explanation for filter query parameter and mentions that limit…
gmourier Nov 3, 2022
c0bf5bf
Fix typo in property name
gmourier Nov 3, 2022
3403292
Update query paramters name and related error codes when invalid
gmourier Nov 3, 2022
e9099f5
Fix missing part of error msg
gmourier Nov 3, 2022
58dbc76
Precise valid date formats
gmourier Nov 3, 2022
9043614
Add supported format for date filters in open-api.yml
gmourier Nov 15, 2022
680d847
Update open-api.yaml
gmourier Nov 15, 2022
80593b0
Update text/0060-tasks-api.md
gmourier Nov 15, 2022
198d6a4
fix typo
gmourier Nov 15, 2022
04ffeaf
Update open-api.yaml
gmourier Nov 21, 2022
f6a063d
Update text/0060-tasks-api.md
gmourier Nov 21, 2022
1253922
Update text/0060-tasks-api.md
gmourier Nov 23, 2022
9c6c396
Merge branch 'release-v0.30.0' into cancel-tasks-feature
gmourier Nov 29, 2022
15ac726
Tasks API - Add task deletion capability (#198)
gmourier Nov 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
168 changes: 151 additions & 17 deletions open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ components:
indexUid: movies
status: succeeded
type: documentAdditionOrUpdate
canceledBy: null
details:
receivedDocuments: 10
indexedDocuments: 10
Expand Down Expand Up @@ -313,6 +314,10 @@ components:
- indexDeletion
- settingsUpdate
- dumpCreation
- taskCancelation
canceledBy:
type: integer
description: The uid of the task that performed the taskCancelation if the task has been canceled.
details:
type: object
description: Details information of the task payload.
Expand All @@ -328,7 +333,7 @@ components:
description: Number of document ids received for documentDeletion task.
deletedDocuments:
type: integer
description: 'Number of documents finally deleted for documentDeletion and indexDeletion tasks.'
description: Number of documents finally deleted for documentDeletion and indexDeletion tasks.
primaryKey:
type: string
description: Value for the primaryKey field encountered if any for indexCreation or indexUpdate task.
Expand All @@ -337,6 +342,15 @@ components:
dumpUid:
type: string
description: Identifier generated for the dump for dumpCreation task.
matchedTasks:
type: integer
description: Number of tasks that match the task cancelation request.
canceledTasks:
type: integer
description: Number of tasks canceled.
originalFilters:
type: string
description: Filters used for the cancelation task.
gmourier marked this conversation as resolved.
Show resolved Hide resolved
error:
description: Error object containing error details and context when a task has a failed status.
$ref: '#/components/schemas/error'
Expand All @@ -360,6 +374,9 @@ components:
- indexUid
- status
- type
- canceledBy
- details
- error
- enqueuedAt
- startedAt
- finishedAt
Expand Down Expand Up @@ -393,6 +410,7 @@ components:
- indexDeletion
- settingsUpdate
- dumpCreation
- taskCancelation
enqueuedAt:
description: Represent the date and time as a `RFC 3339` format when the task has been enqueued
$ref: '#/components/schemas/timestamp'
Expand Down Expand Up @@ -641,6 +659,7 @@ components:
- indexes.update
- indexes.delete
- tasks.get
- tasks.cancel
- settings.get
- settings.update
- stats.get
Expand Down Expand Up @@ -709,28 +728,84 @@ components:
taskUid:
name: taskUid
in: path
description: The task unique identifier
description: The task identifier
required: true
schema:
type: integer
taskFilterUids:
name: uids
in: query
description: Permits to filter tasks by their uid. By default, when the `uids` query parameter is not set, all task uids are returned. It's possible to specify several uids by separating them with the `,` character.
required: false
schema:
type: number
taskIndexUid:
name: indexUid
taskFilterIndexUids:
name: indexUids
in: query
description: Permits to filter tasks by their related index. By default, when `indexUids` query parameter is not set, the tasks of all the indexes are returned. It is possible to specify several indexes by separating them with the `,` character.
required: false
schema:
type: string
taskFilterTypes:
name: types
in: query
description: Permits to filter tasks by their related type. By default, when `types` query parameter is not set, all task types are returned. It's possible to specify several types by separating them with the `,` character.
required: false
schema:
type: string
taskFilterStatuses:
name: statuses
in: query
description: Permits to filter tasks by their status. By default, when `statuses` query parameter is not set, all task statuses are returned. It's possible to specify several statuses by separating them with the `,` character.
required: false
schema:
type: string
taskFilterBeforeEnqueuedAt:
name: beforeEnqueuedAt
in: query
description: Permits to filter tasks based on their enqueuedAt time. Matches tasks enqueued before the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskFilterAfterEnqueuedAt:
name: afterEnqueuedAt
in: query
description: Permits to filter tasks based on their enqueuedAt time. Matches tasks enqueued after the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskFilterBeforeStartedAt:
name: beforeStartedAt
in: query
description: Permits to filter tasks based on their startedAt time. Matches tasks started before the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskFilterAfterStartedAt:
name: afterStartedAt
in: query
description: Permits to filter tasks by their related index. By default, when `indexUid` query parameter is not set, the tasks of all the indexes are returned. It is possible to specify several indexes by separating them with the `,` character.
description: Permits to filter tasks based on their startedAt time. Matches tasks started after the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskType:
name: type
taskFilterBeforeFinishedAt:
name: beforeFinishedAt
in: query
description: Permits to filter tasks by their related type. By default, when `type` query parameter is not set, all task types are returned. It's possible to specify several types by separating them with the `,` character.
description: Permits to filter tasks based on their finishedAt time. Matches tasks finished before the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskStatus:
name: status
taskFilterAfterFinishedAt:
name: afterFinishedAt
in: query
description: Permits to filter tasks by their status. By default, when `status` query parameter is not set, all task statuses are returned. It's possible to specify several types by separating them with the `,` character.
description: Permits to filter tasks based on their finishedAt time. Matches tasks finished after the given date. Supports RFC 3339 date format.
required: false
schema:
type: string
taskFilterCanceledBy:
name: canceledBy
in: query
description: Permits to filter tasks using the uid of the task that canceled them. It's possible to specify several task uids by separating them with the `,` character.
required: false
schema:
type: string
Expand Down Expand Up @@ -1013,6 +1088,14 @@ components:
status: enqueued
type: dumpCreation
enqueuedAt: '2021-01-01T09:39:00.000000Z'
202_taskCancelation:
summary: 202 Accepted taskCancelation response example
value:
taskUid: 0
indexUid: null
status: enqueued
type: taskCancelation
enqueuedAt: '2021-01-01T09:39:00.000000Z'
tags:
- name: Indexes
description: |
Expand Down Expand Up @@ -3327,9 +3410,11 @@ paths:
indexUid: movies
status: succeeded
type: documentAdditionOrUpdate
canceledBy: null
details:
receivedDocuments: 79000
indexedDocuments: 79000
error: null
duration: PT1S
enqueuedAt: '2021-01-01T09:39:00.000000Z'
startedAt: '2021-01-01T09:39:01.000000Z'
Expand All @@ -3338,6 +3423,7 @@ paths:
indexUid: movies_Review
status: failed
type: documentAdditionOrUpdate
canceledBy: null
details:
receivedDocuments: 67493
indexedDocuments: 0
Expand All @@ -3357,9 +3443,17 @@ paths:
parameters:
- $ref: '#/components/parameters/limit'
- $ref: '#/components/parameters/from'
- $ref: '#/components/parameters/taskIndexUid'
- $ref: '#/components/parameters/taskStatus'
- $ref: '#/components/parameters/taskType'
- $ref: '#/components/parameters/taskFilterUids'
- $ref: '#/components/parameters/taskFilterIndexUids'
- $ref: '#/components/parameters/taskFilterStatuses'
- $ref: '#/components/parameters/taskFilterTypes'
- $ref: '#/components/parameters/taskFilterCanceledBy'
- $ref: '#/components/parameters/taskFilterBeforeEnqueuedAt'
- $ref: '#/components/parameters/taskFilterAfterEnqueuedAt'
- $ref: '#/components/parameters/taskFilterBeforeStartedAt'
- $ref: '#/components/parameters/taskFilterAfterStartedAt'
- $ref: '#/components/parameters/taskFilterBeforeFinishedAt'
- $ref: '#/components/parameters/taskFilterAfterFinishedAt'
security:
- apiKey: []
'/tasks/:taskUid':
Expand All @@ -3382,9 +3476,11 @@ paths:
indexUid: movies
status: succeeded
type: documentAdditionOrUpdate
canceledBy: null
details:
receivedDocuments: 79000
indexedDocuments: 79000
error: null
duration: PT1S
enqueuedAt: '2021-01-01T09:39:00.000000Z'
startedAt: '2021-01-01T09:39:01.000000Z'
Expand All @@ -3405,9 +3501,47 @@ paths:
type: invalid_request
link: 'https://docs.meilisearch.com/errors/#task_not_found'
operationId: tasks.get
parameters: []
parameters:
- $ref: '#/components/parameters/taskUid'
security:
- apiKey: []
'/tasks/cancel':
post:
summary: Cancel tasks
description: 'Cancel enqueued and/or processing [tasks](https://docs.meilisearch.com/learn/advanced/asynchronous_operations.html) '
gmourier marked this conversation as resolved.
Show resolved Hide resolved
tags:
- tasks
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/summarizedTask'
examples:
'202':
$ref: '#/components/examples/202_taskCancelation'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/error'
'401':
$ref: '#/components/responses/401'
operationId: tasks.cancel
parameters:
- $ref: '#/components/parameters/taskFilterUids'
- $ref: '#/components/parameters/taskFilterIndexUids'
- $ref: '#/components/parameters/taskFilterStatuses'
- $ref: '#/components/parameters/taskFilterTypes'
- $ref: '#/components/parameters/taskFilterCanceledBy'
- $ref: '#/components/parameters/taskFilterBeforeEnqueuedAt'
- $ref: '#/components/parameters/taskFilterAfterEnqueuedAt'
- $ref: '#/components/parameters/taskFilterBeforeStartedAt'
- $ref: '#/components/parameters/taskFilterAfterStartedAt'
- $ref: '#/components/parameters/taskFilterBeforeFinishedAt'
- $ref: '#/components/parameters/taskFilterAfterFinishedAt'
security:
- apiKey: []
parameters:
- $ref: '#/components/parameters/taskUid'
security: []
48 changes: 41 additions & 7 deletions text/0034-telemetry-policies.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Title: Anonymous Analytics Policy
- title: Anonymous analytics policy
- Started At: 2021-04-16
- Updated At: 2021-10-13

Expand Down Expand Up @@ -58,6 +58,7 @@ The collected data is sent to [Segment](https://segment.com/). Segment is a plat
| Faceting Updated | Occurs when faceting settings are updated via `PATCH` — `/indexes/:indexUid/settings/faceting`. |
| Dump Created | Occurs when a dump is created via `POST` - `/dumps`. |
| Tasks Seen | Occurs when tasks are fetched globally via `GET` - `/tasks`. |
| Tasks Canceled | Occurs when tasks are requested to be canceled via `POST` - `/tasks/cancel`. |
| Stats Seen | Occurs when stats are fetched via `GET` - `/stats` or `/indexes/:indexUid/stats`. |

----
Expand Down Expand Up @@ -131,9 +132,17 @@ The collected data is sent to [Segment](https://segment.com/). Segment is a plat
| `pagination.max_total_hits` | The defined value for `pagination.maxTotalHits` property | `1000` | `Settings Updated`, `Pagination Updated` |
| `faceting.max_values_per_facet` | The defined value for `faceting.maxValuesPerFacet` property | `100` | `Settings Updated`, `Faceting Updated` |
| `per_task_uid` | `true` if an uid is used to fetch a particular task resource, otherwise `false` | true | `Tasks Seen` |
| `filtered_by_index_uid` | `true` if `GET /tasks` endpoint is filered by `indexUid`, otherwise `false` | false | `Tasks Seen` |
| `filtered_by_type` | `true` if `GET /tasks` endpoint is filered by `type`, otherwise `false` | false | `Tasks Seen` |
| `filtered_by_status` | `true` if `GET /tasks` endpoint is filered by `status`, otherwise `false` | false | `Tasks Seen` |
| `filtered_by_uid` | `true` if tasks are filtered by the `uids` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_index_uid` | `true` if tasks are filtered by the `indexUids` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_type` | `true` if tasks are filtered by the `types` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_status` | `true` if tasks are filtered by the `statuses` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_canceled_by` | `true` if tasks are filtered by the `canceledBy` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_before_enqueued_at` | `true` if tasks are filtered by the `beforeEnqueuedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_after_enqueued_at ` | `true` if tasks are filtered by the `afterEnqueuedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_before_started_at` | `true` if tasks are filtered by the `beforeStartedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_after_started_at` | `true` if tasks are filtered by the `afterStartedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_before_finished_at` | `true` if tasks are filtered by the `beforeFinishedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `filtered_by_after_finished_at` | `true` if tasks are filtered by the `afterFinishedAt` query parameter, otherwise `false` | false | `Tasks Seen`, `Tasks Canceled` |
| `per_index_uid` | `true` if an uid is used to fetch an index stat resource, otherwise `false` | false | `Stats Seen` |
| `most_used_matching_strategy` | Most used word matching strategy among all search requests in this batch | `last` | `Documents Searched POST`, `Documents Searched GET` |

Expand Down Expand Up @@ -387,9 +396,34 @@ This property allows us to gather essential information to better understand on
|---------------|-------------|---------|
| user_agent | Represents the user-agent encountered on this call. | `["Meilisearch Ruby (v2.1)", "Ruby (3.0)"]` |
| per_task_uid | `true` if an uid is used to fetch a particular task resource, otherwise `false` | `true` |
| filtered_by_index_uid | `true` if `GET /tasks` endpoint is filered by `indexUid`, otherwise `false` | `false` |
| filtered_by_type | `true` if `GET /tasks` endpoint is filered by `type`, otherwise `false` | `false` |
| filtered_by_status | `true` if `GET /tasks` endpoint is filered by `status`, otherwise `false` | `false` |
| filtered_by_uid | `true` if tasks are filtered by the `uids` query parameter, otherwise `false` | false |
| filtered_by_index_uid | `true` if tasks are filtered by the `indexUids` query parameter, otherwise `false` | false |
| filtered_by_type | `true` if tasks are filtered by the `types` query parameter, otherwise `false` | false |
| filtered_by_status | `true` if tasks are filtered by the `statuses` query parameter, otherwise `false` | false |
| filtered_by_canceled_by | `true` if tasks are filtered by the `canceledBy` query parameter, otherwise `false` | false |
| filtered_by_before_enqueued_at | `true` if tasks are filtered by the `beforeEnqueuedAt` query parameter, otherwise `false` | false |
| filtered_by_after_enqueued_at | `true` if tasks are filtered by the `afterEnqueuedAt` query parameter, otherwise `false` | false |
| filtered_by_before_started_at | `true` if tasks are filtered by the `beforeStartedAt` query parameter, otherwise `false` | false |
| filtered_by_after_started_at | `true` if tasks are filtered by the `afterStartedAt` query parameter, otherwise `false` | false |
| filtered_by_before_finished_at | `true` if tasks are filtered by the `beforeFinishedAt` query parameter, otherwise `false` | false |
| filtered_by_after_finished_at | `true` if tasks are filtered by the `afterFinishedAt` query parameter, otherwise `false` | false |

## `Tasks Canceled`

| Property name | Description | Example |
|---------------|-------------|---------|
| user_agent | Represents the user-agent encountered on this call. | `["Meilisearch Ruby (v2.1)", "Ruby (3.0)"]` |
| filtered_by_uid | `true` if tasks are filtered by the `uids` query parameter, otherwise `false` | false |
| filtered_by_index_uid | `true` if tasks are filtered by the `indexUids` query parameter, otherwise `false` | false |
| filtered_by_type | `true` if tasks are filtered by the `types` query parameter, otherwise `false` | false |
| filtered_by_status | `true` if tasks are filtered by the `statuses` query parameter, otherwise `false` | false |
| filtered_by_canceled_by | `true` if tasks are filtered by the `canceledBy` query parameter, otherwise `false` | false |
| filtered_by_before_enqueued_at | `true` if tasks are filtered by the `beforeEnqueuedAt` query parameter, otherwise `false` | false |
| filtered_by_after_enqueued_at | `true` if tasks are filtered by the `afterEnqueuedAt` query parameter, otherwise `false` | false |
| filtered_by_before_started_at | `true` if tasks are filtered by the `beforeStartedAt` query parameter, otherwise `false` | false |
| filtered_by_after_started_at | `true` if tasks are filtered by the `afterStartedAt` query parameter, otherwise `false` | false |
| filtered_by_before_finished_at | `true` if tasks are filtered by the `beforeFinishedAt` query parameter, otherwise `false` | false |
| filtered_by_after_finished_at | `true` if tasks are filtered by the `afterFinishedAt` query parameter, otherwise `false` | false |

## `Stats Seen`

Expand Down