[ML] Gracefully shutdown model deployment when node is removed from assignment routing#134673
Merged
jonathan-buttner merged 9 commits intoelastic:mainfrom Sep 25, 2025
Merged
Conversation
Collaborator
|
Hi @jonathan-buttner, I've created a changelog YAML for you. |
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
DonalEvans
approved these changes
Sep 15, 2025
| if (task == null) { | ||
| logger.debug( | ||
| () -> format( | ||
| "[%s] Unable to stop unreferenced deployment for node %s because task does not exit", |
Contributor
There was a problem hiding this comment.
Should this be "task does not exist"?
| trainedModelAssignmentNodeService.prepareModelToLoad(taskParams); | ||
| trainedModelAssignmentNodeService.clusterChanged(event); | ||
|
|
||
| assertBusy(() -> { verify(deploymentManager, times(1)).stopAfterCompletingPendingWork(any()); }); |
Contributor
There was a problem hiding this comment.
Nitpick, are the curly brackets needed around the lambda here?
DonalEvans
approved these changes
Sep 16, 2025
This was referenced Sep 25, 2025
jonathan-buttner
added a commit
to jonathan-buttner/elasticsearch
that referenced
this pull request
Sep 25, 2025
…ssignment routing (elastic#134673) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
jonathan-buttner
added a commit
to jonathan-buttner/elasticsearch
that referenced
this pull request
Sep 25, 2025
…ssignment routing (elastic#134673) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Collaborator
jonathan-buttner
added a commit
to jonathan-buttner/elasticsearch
that referenced
this pull request
Sep 25, 2025
…ssignment routing (elastic#134673) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 25, 2025
…ssignment routing (#134673) (#135436) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 25, 2025
…ssignment routing (#134673) (#135438) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 25, 2025
…ssignment routing (#134673) (#135439) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine
pushed a commit
that referenced
this pull request
Sep 25, 2025
…ssignment routing (#134673) (#135437) * Initial fix for graceful shutdown for unreferenced nodes * Update docs/changelog/134673.yaml * [CI] Auto commit changes from spotless * Fixing cluster change test and flaky tests * [CI] Auto commit changes from spotless * Addressing feedback --------- Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
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.
This PR changes the behavior to have deployments be gracefully shutdown (queued requests completed) in the situation where a node has been removed from an assignment's routing table.
There are a few other places where we should determine if we want to perform a graceful shutdown:
https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/TrainedModelAssignmentNodeService.java#L424
-It’s probably unlikely that we have anything to drain from the queues, but we could try
https://github.com/elastic/elasticsearch/blob/main/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/inference/assignment/TrainedModelAssignmentNodeService.java#L793
After chatting with Dave we decided not to change these other places. If a deployment fails while trying to load, there shouldn't be any requests in the queue. For the situation where an assignment does not exist, that should only occur if the assignment is stopped which should trigger the logic already.