-
Notifications
You must be signed in to change notification settings - Fork 8.5k
🌊 Add task service and client to manage background tasks #245725
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?
🌊 Add task service and client to manage background tasks #245725
Conversation
|
🤖 Jobs for this PR can be triggered through checkboxes. 🚧
ℹ️ To trigger the CI, please tick the checkbox below 👇
|
| const response = await this.storageClient.get({ | ||
| id, | ||
| }); |
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.
Do we need to store the task state on our end or can we use the task manager interface ? Can the task manager tell us the state of a task given an id ?
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.
Single run tasks are deleted upon completion, so neither status nor state is stored.
| id: types.keyword(), | ||
| status: types.keyword(), | ||
| payload: types.object({ enabled: false }), | ||
| error: types.keyword(), |
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.
We need a created_at field and some timeout logic in the scheduling route to prevent a failed task from being in running mode indefinitely
| request: KibanaRequest; | ||
| } | ||
|
|
||
| export class TaskClient<TaskType extends string> { |
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.
should probably use a lockManager unless the taskManager provides a guard for us ? what happens if we schedule a task with the same id ?
See WIP usage here