-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove tasks with cleanup logic instead of marking them as failed (#1…
…52841) Part of #79977 (step 1 and 3). In this PR, I'm making Task Manager remove tasks instead of updating them with `status: failed` whenever a task is out of attempts. I've also added an optional `cleanup` hook to the task runner that can be defined if additional cleanup is necessary whenever a task has been deleted (ex: delete `action_task_params`). ## To verify an ad-hoc task that always fails 1. With this PR codebase, modify an action to always throw an error 2. Create an alerting rule that will invoke the action once 3. See the action fail three times 4. Observe the task SO is deleted (search by task type / action type) alongside the action_task_params SO ## To verify Kibana crashing on the last ad-hoc task attempt 1. With this PR codebase, modify an action to always throw an error (similar to scenario above) but also add a delay of 10s before the error is thrown (`await new Promise((resolve) => setTimeout(resolve, 10000));` and a log message before the delay begins 2. Create an alerting rule that will invoke the action once 3. See the action fail twice 4. On the third run, crash Kibana while the action is waiting for the 10s delay, this will cause the action to still be marked as running while it no longer is 5. Restart Kibana 6. Wait 5-10m until the task's retryAt is overdue 7. Observe the task getting deleted and the action_task_params getting deleted ## To verify recurring tasks that continuously fail 1. With this PR codebase, modify a rule type to always throw an error when it runs 2. Create an alerting rule of that type (with a short interval) 3. Observe the rule continuously running and not getting trapped into the PR changes Flaky test runner: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2036 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
- Loading branch information
1 parent
dec52ef
commit 676aec7
Showing
27 changed files
with
493 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.