[ML] Set parent task when calling infer action from internal infer#80731
Conversation
This commit sets the parent task id to the trained model infer action when it is called from the internal infer action (ingest use case).
|
Pinging @elastic/ml-core (Team:ML) |
💔 Backport failed
You can use sqren/backport to manually backport by running |
…lastic#80731) This commit sets the parent task id to the trained model infer action when it is called from the internal infer action (ingest use case).
| request.setParentTaskId(taskId); | ||
| executeAsyncWithOrigin( | ||
| client, | ||
| new ParentTaskAssigningClient(client, taskId), |
There was a problem hiding this comment.
ParentTaskAssigningClient calls request.setParentTaskId(taskId); exactly as you have done in line 193 you should either set request.setParentTaskId(taskId); yourself or use the ParentTaskAssigningClient not both.
There was a problem hiding this comment.
I tried that at first. When the internal infer calls the trained model infer action, two tasks are created for the trained model infer action. One tagged with [n] for node level and another one. If I don't use a ParentTaskAssigningClient the node task is not parented properly.
There was a problem hiding this comment.
Actually, I revisited this. From testing it seems that setting the parent task id on the request has no effect. Only when calling with the ParentTaskAssigningClient the result task is parented correctly. I'll follow up with a PR to remove setting the parent task id on the request.
In elastic#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.
…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 <elasticmachine@users.noreply.github.com>
…lastic#80905) In elastic#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 <elasticmachine@users.noreply.github.com>
…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 <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit sets the parent task id to the trained model infer action
when it is called from the internal infer action (ingest use case).