Skip to content

Commit

Permalink
[ML] No need to use parent task client when internal infer delegates (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
dimitris-athanasiou and elasticmachine authored Nov 23, 2021
1 parent 7db06c1 commit 1c623d0
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1c623d0

Please sign in to comment.