-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Task Manager] Mark task as failed if maxAttempts has been met. #80681
[Task Manager] Mark task as failed if maxAttempts has been met. #80681
Conversation
x-pack/plugins/task_manager/server/queries/mark_available_tasks_as_claimed.ts
Outdated
Show resolved
Hide resolved
…manager/mark-task-as-failed
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
@elasticmachine merge upstream |
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.
Changes LGTM! Tried it locally and I can see the tasks marked as failed whenever retryAt
is passed and attempts
exceeds the configuration 👍
x-pack/plugins/task_manager/server/queries/mark_available_tasks_as_claimed.ts
Show resolved
Hide resolved
shouldBeOneOf<ExistsFilter | TermFilter | RangeFilter>( | ||
TaskWithSchedule, | ||
...tasksWithRemainingAttempts | ||
) |
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.
❤️ this is going to make the query soo much smaller
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.
:elasticheart:
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
@@ -40,29 +31,29 @@ describe('mark_available_tasks_as_claimed', () => { | |||
createTaskRunner: () => ({ run: () => Promise.resolve() }), | |||
}, | |||
}); | |||
const claimTasksById = undefined; |
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.
nit: I think it could be just array of strings like:
const claimTasksById: string[] = [];
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
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.
Whoop whoop, works as expected, good job 👍
…tic#80681) * wip * Adding updateFieldsAndMarkAsFailed function * Updating UBQ * Only updating retryAt if marking as claiming * Updating query * Updating query to only fail one time tasks that have exceeded max attempts * Fixing tests * Fixing tests * Handling claiming tasks by id * Removing unused function Co-authored-by: Kibana Machine <[email protected]>
…) (#81750) * wip * Adding updateFieldsAndMarkAsFailed function * Updating UBQ * Only updating retryAt if marking as claiming * Updating query * Updating query to only fail one time tasks that have exceeded max attempts * Fixing tests * Fixing tests * Handling claiming tasks by id * Removing unused function Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
* master: [Security Solution][Endpoint][Admin] Malware Protections Notify User Version (elastic#81415) Revert "[Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)" [Maps] Use default format when proxying EMS-files (elastic#79760) [Discover] Deangularize context.html (elastic#81442) Use the displayName property in default editor (elastic#73311) adds bug label to Bug report for Security Solution template (elastic#81643) [ML] Transforms: Remove index field limitation for custom query. (elastic#81467) [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390) [Task Manager] Mark task as failed if maxAttempts has been met. (elastic#80681) [Lens] Fix URL query loss on redirect (elastic#81475) Log reason for 404 in field existence check (elastic#81315)
* master: (87 commits) [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81778) [i18n] add get_kibana_translation_paths tests (elastic#81624) [UX] Fix search term reset from url (elastic#81654) [Lens] Improved range formatter (elastic#80132) [Resolver] `SideEffectContext` changes, remove `@testing-library` uses (elastic#81077) [Time to Visualize] Update Library Text with Call to Action (elastic#81667) [docs] Resolving failed Kibana upgrade migrations (elastic#80999) [ftr/menuToggle] provide helper for enhanced menu toggle handling (elastic#81709) [Task Manager] adds basic observability into Task Manager's runtime operations (elastic#77868) Doc changes for stack management and grouped feature privileges (elastic#80486) Added functional test for alerts list filters by status, alert type and action type. Did a code refactoring and splitting for alerts tests. (elastic#81422) [Security Solution][Endpoint][Admin] Malware Protections Notify User Version (elastic#81415) Revert "[Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390)" [Maps] Use default format when proxying EMS-files (elastic#79760) [Discover] Deangularize context.html (elastic#81442) Use the displayName property in default editor (elastic#73311) adds bug label to Bug report for Security Solution template (elastic#81643) [ML] Transforms: Remove index field limitation for custom query. (elastic#81467) [Actions] Adding `hasAuth` to Webhook Configuration to avoid confusing UX (elastic#81390) [Task Manager] Mark task as failed if maxAttempts has been met. (elastic#80681) ...
Resolves #79165
Summary
Uses
updateByQuery
to mark non-recurring tasks that have exceeded itsmaxAttempts
asfailed
instead of leaving them in arunning
state.Previously, query portion of the
updateByQuery
included a clause that searched for tasks with a schedule or tasks where attempts < maxAttempts. Moved this check from the query into the painless script. Tasks that don't meet this condition (non-recurring tasks that have exceeded itsmaxAttempts
) are updated tofailed
while other tasks are claimed as normal.Checklist
Delete any items that are not applicable to this PR.