[ML] Add "close_job" parameter to the stop datafeed API#138634
Merged
edsavage merged 11 commits intoelastic:mainfrom Dec 3, 2025
Merged
[ML] Add "close_job" parameter to the stop datafeed API#138634edsavage merged 11 commits intoelastic:mainfrom
edsavage merged 11 commits intoelastic:mainfrom
Conversation
When the stop datafeed API is called with close_job=true the job associated with the datafeed will be closed first, which in turn will result in the datafeed being closed. Closes elastic#138010
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
Collaborator
|
Hi @edsavage, I've created a changelog YAML for you. |
…op_datafeed_close_job_param
…nto stop_datafeed_close_job_param
…op_datafeed_close_job_param
davidkyle
approved these changes
Nov 28, 2025
Member
davidkyle
left a comment
There was a problem hiding this comment.
LGTM
Couple of minor comments. The change is well tested
...-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java
Outdated
Show resolved
Hide resolved
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStopDatafeedAction.java
Outdated
Show resolved
Hide resolved
valeriy42
reviewed
Dec 1, 2025
Contributor
valeriy42
left a comment
There was a problem hiding this comment.
Great work on implementing this PR! I like how clean it is. I have only a couple of suggestions and questions.
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStopDatafeedAction.java
Outdated
Show resolved
Hide resolved
Comment on lines
242
to
244
| logger.warn("Failed to close jobs (and associated datafeeds): {}", jobIds); | ||
| } | ||
| delegate.onResponse(new StopDatafeedAction.Response(true)); |
Contributor
There was a problem hiding this comment.
Does it make sense to fail the request if any job failed to close? Right now, the call always returns Response(true).
Contributor
Author
There was a problem hiding this comment.
Yes, that's a good idea. Thanks!
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStopDatafeedAction.java
Outdated
Show resolved
Hide resolved
...k/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStopDatafeedAction.java
Show resolved
Hide resolved
...-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java
Outdated
Show resolved
Hide resolved
...-node-tests/src/javaRestTest/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsIT.java
Outdated
Show resolved
Hide resolved
* Better error checking * Extra test cases
…earch into stop_datafeed_close_job_param
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.
When the stop datafeed API is called with close_job=true the job associated with the datafeed will be closed first, which in turn will result in the datafeed being closed.
Closes #138010