[ML] Prevent get datafeeds stats API returning an error when local tasks are slow to stop#104352
Open
aishwarysingh7754 wants to merge 1 commit intoelastic:mainfrom
Open
[ML] Prevent get datafeeds stats API returning an error when local tasks are slow to stop#104352aishwarysingh7754 wants to merge 1 commit intoelastic:mainfrom
aishwarysingh7754 wants to merge 1 commit intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
|
Thanks for the contribution @aishwarysingh7754. Please could you push an extra file to your branch, called Also, you'll find that our automatic code formatter won't like the formatting changes you've made. We use an automatic code formatter because although nobody 100% likes the way it lays out the code it avoids all arguments about the best layout and avoids needless churn from people changing the layout. To auto-format this change please run |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To solve this issue, I modified the fromResponses method in the Response class to handle duplicate keys more gracefully. The solution involved:
Grouping the running states by datafeedId.
Sorting the running states within each group based on creation time in descending order.
Keeping only the state for the most recent task (the first element after sorting) for each datafeedId.
Fixes #104160