Skip to content

Conversation

@edsavage
Copy link
Contributor

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

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
@elasticsearchmachine elasticsearchmachine added the Team:ML Meta label for the ML team label Nov 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@elasticsearchmachine
Copy link
Collaborator

Hi @edsavage, I've created a changelog YAML for you.

@edsavage edsavage requested a review from valeriy42 November 27, 2025 03:12
Copy link
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Couple of minor comments. The change is well tested

});
}

private void doTestRealtime_GivenCloseJobParameter(String jobId, boolean closeJobParameter, JobState jobState) throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are closeJobParameter and jobState used in this method?

}
}
if (request.closeJob() && startedDatafeedsJobs.isEmpty() == false) {
// If the "close_job" parameter was set to "true" on the stop datafeed request we attempt to first close the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the close jobs action where the datafeed is stopped please explicitly set close job to false so when looking at that code we are aware of this interation

StopDatafeedAction.Request request = new StopDatafeedAction.Request(String.join(",", runningDatafeedIds));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EnableJiraSync >enhancement :ml Machine learning Team:ML Meta label for the ML team v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ML] Add flag to auto-close the anomaly detection job when the associated datafeed is stopped

3 participants