Skip to content

Commit 01d71d2

Browse files
[ML] Force stopping stopped DF analytics should succeed (#56421)
Force stopping a DF analytics job whose config exists and that is stopped should succeed. This was broken by #56360. Closes #56414
1 parent 0ae0e70 commit 01d71d2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStopDataFrameAnalyticsAction.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,16 @@ private void matchAllStartedIds(StopDataFrameAnalyticsAction.Request request, Se
154154
ExpandedIdsMatcher expandedIdsMatcher = new ExpandedIdsMatcher(tokens, request.allowNoMatch());
155155
expandedIdsMatcher.filterMatchedIds(startedIds);
156156
if (expandedIdsMatcher.hasUnmatchedIds()) {
157-
matchingIdsListener.onFailure(ExceptionsHelper.missingDataFrameAnalytics(expandedIdsMatcher.unmatchedIdsString()));
158-
return;
157+
// There are expressions that did not match any started task.
158+
// If there are no configs for those either, we should error.
159+
// We check this by trying a get with the unmatched expressions.
160+
configProvider.getMultiple(expandedIdsMatcher.unmatchedIdsString(), request.allowNoMatch(), ActionListener.wrap(
161+
configs -> matchingIdsListener.onResponse(MlStrings.findMatching(tokens, startedIds)),
162+
matchingIdsListener::onFailure
163+
));
164+
} else {
165+
matchingIdsListener.onResponse(MlStrings.findMatching(tokens, startedIds));
159166
}
160-
Set<String> matchingStartedIds = MlStrings.findMatching(tokens, startedIds);
161-
matchingIdsListener.onResponse(matchingStartedIds);
162167
}
163168

164169
private void normalStop(Task task, StopDataFrameAnalyticsAction.Request request,

0 commit comments

Comments
 (0)