[7.x][ML] Stop df-analytics action request should filter tasks (#44016) (#44023)

As a `BaseTasksRequest`, `StopDataFrameAnalyticsAction.Request` should
implement a `match` method that makes sure only df-analytics tasks
are applied.
This commit is contained in:
Dimitris Athanasiou 2019-07-05 23:10:45 +03:00 committed by GitHub
parent 504a43d43a
commit a1a62fded3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,7 @@ import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.ToXContentObject;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig;
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
@ -125,6 +126,11 @@ public class StopDataFrameAnalyticsAction extends ActionType<StopDataFrameAnalyt
this.expandedIds = Objects.requireNonNull(expandedIds);
}
@Override
public boolean match(Task task) {
return expandedIds.stream().anyMatch(expandedId -> StartDataFrameAnalyticsAction.TaskMatcher.match(task, expandedId));
}
@Override
public ActionRequestValidationException validate() {
return null;