From 1c623d0f46fc21cc5584343dcb810cdf2f8df5e0 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Tue, 23 Nov 2021 12:03:45 +0200 Subject: [PATCH] [ML] No need to use parent task client when internal infer delegates (#80905) In #80731 the infer trained model task was correctly set to have as parent task the internal infer action task when called from there. However, it was done by both setting `Request.setParentTaskId` and using a `ParentTaskAssigningClient`. There is no need to use a parent task client. Instead, to set the parent task on the request we should use `setParentTask` instead of `setParentTaskId` which effectively sets the target task for a `BaseTasksRequest`. The confusion of `BaseTasksRequest` holding two fields both names `parentTaskId` and having two methods both setting the parent task id will be addressed in a separate PR. Co-authored-by: Elastic Machine --- .../xpack/ml/action/TransportInternalInferModelAction.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportInternalInferModelAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportInternalInferModelAction.java index 18e66f785fdf4..83afae8777884 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportInternalInferModelAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportInternalInferModelAction.java @@ -12,7 +12,6 @@ import org.elasticsearch.action.support.ActionFilters; import org.elasticsearch.action.support.HandledTransportAction; import org.elasticsearch.client.Client; -import org.elasticsearch.client.ParentTaskAssigningClient; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.core.TimeValue; @@ -190,9 +189,9 @@ private void inferSingleDocAgainstAllocatedModel( Collections.singletonList(doc), TimeValue.MAX_VALUE ); - request.setParentTaskId(taskId); + request.setParentTask(taskId); executeAsyncWithOrigin( - new ParentTaskAssigningClient(client, taskId), + client, ML_ORIGIN, InferTrainedModelDeploymentAction.INSTANCE, request,