Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] make ML stats APIs cancellable #88030

Merged
merged 3 commits into from
Jun 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
addressing pr comments
benwtrent committed Jun 28, 2022
commit 7527dbfb9bc58d4dcfef7d111f59c12b7a5afe6e
Original file line number Diff line number Diff line change
@@ -247,7 +247,7 @@ static List<DataFrameAnalyticsConfig> determineStoppedConfigs(List<DataFrameAnal
return configs.stream().filter(config -> startedTasksIds.contains(config.getId()) == false).collect(Collectors.toList());
}

private void searchStats(DataFrameAnalyticsConfig config, TaskId parenTaskId, ActionListener<Stats> listener) {
private void searchStats(DataFrameAnalyticsConfig config, TaskId parentTaskId, ActionListener<Stats> listener) {
logger.debug("[{}] Gathering stats for stopped task", config.getId());

RetrievedStatsHolder retrievedStatsHolder = new RetrievedStatsHolder(
@@ -261,7 +261,7 @@ private void searchStats(DataFrameAnalyticsConfig config, TaskId parenTaskId, Ac
multiSearchRequest.add(buildStatsDocSearch(config.getId(), OutlierDetectionStats.TYPE_VALUE));
multiSearchRequest.add(buildStatsDocSearch(config.getId(), ClassificationStats.TYPE_VALUE));
multiSearchRequest.add(buildStatsDocSearch(config.getId(), RegressionStats.TYPE_VALUE));
multiSearchRequest.setParentTask(parenTaskId);
multiSearchRequest.setParentTask(parentTaskId);

executeAsyncWithOrigin(
client,
Original file line number Diff line number Diff line change
@@ -144,6 +144,7 @@ protected void taskOperation(
JobTask task,
ActionListener<QueryPage<JobStats>> listener
) {
TaskId parentTaskId = new TaskId(clusterService.getNodeName(), actionTask.getId());
String jobId = task.getJobId();
ClusterState state = clusterService.state();
PersistentTasksCustomMetadata tasks = state.getMetadata().custom(PersistentTasksCustomMetadata.TYPE);
@@ -157,8 +158,7 @@ protected void taskOperation(
JobState jobState = MlTasks.getJobState(jobId, tasks);
String assignmentExplanation = pTask.getAssignment().getExplanation();
TimeValue openTime = processManager.jobOpenTime(task).map(value -> TimeValue.timeValueSeconds(value.getSeconds())).orElse(null);
// TODO can we set the request parent task ID here???
jobResultsProvider.getForecastStats(jobId, null, forecastStats -> {
jobResultsProvider.getForecastStats(jobId, parentTaskId, forecastStats -> {
JobStats jobStats = new JobStats(
jobId,
dataCounts,