Skip to content

Commit c7a8f88

Browse files
[ML] No need to use parent task client when internal infer delegates (#80905) (#80934)
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 <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
1 parent 18c3eb7 commit c7a8f88

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import org.elasticsearch.action.support.ActionFilters;
1313
import org.elasticsearch.action.support.HandledTransportAction;
1414
import org.elasticsearch.client.Client;
15-
import org.elasticsearch.client.ParentTaskAssigningClient;
1615
import org.elasticsearch.cluster.service.ClusterService;
1716
import org.elasticsearch.common.inject.Inject;
1817
import org.elasticsearch.core.TimeValue;
@@ -186,9 +185,9 @@ private void inferSingleDocAgainstAllocatedModel(
186185
Collections.singletonList(doc),
187186
TimeValue.MAX_VALUE
188187
);
189-
request.setParentTaskId(taskId);
188+
request.setParentTask(taskId);
190189
executeAsyncWithOrigin(
191-
new ParentTaskAssigningClient(client, taskId),
190+
client,
192191
ML_ORIGIN,
193192
InferTrainedModelDeploymentAction.INSTANCE,
194193
request,

0 commit comments

Comments
 (0)