Skip to content

[ML] Set parent task when calling infer action from internal infer#80731

Merged
dimitris-athanasiou merged 1 commit intoelastic:masterfrom
dimitris-athanasiou:set-parent-task-on-calling-infer-action-from-internal
Nov 16, 2021
Merged

[ML] Set parent task when calling infer action from internal infer#80731
dimitris-athanasiou merged 1 commit intoelastic:masterfrom
dimitris-athanasiou:set-parent-task-on-calling-infer-action-from-internal

Conversation

@dimitris-athanasiou
Copy link
Copy Markdown
Contributor

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).

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).
@elasticmachine elasticmachine added the Team:ML Meta label for the ML team label Nov 15, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/ml-core (Team:ML)

@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

💔 Backport failed

Status Branch Result
8.0 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 80731

dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Nov 16, 2021
…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),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

https://github.com/elastic/elasticsearch/blob/master/server/src/main/java/org/elasticsearch/client/ParentTaskAssigningClient.java#L54

Copy link
Copy Markdown
Contributor Author

@dimitris-athanasiou dimitris-athanasiou Nov 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now raised #80905

@dimitris-athanasiou dimitris-athanasiou deleted the set-parent-task-on-calling-infer-action-from-internal branch November 16, 2021 11:13
dimitris-athanasiou added a commit that referenced this pull request Nov 16, 2021
…80731) (#80749)

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).
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Nov 22, 2021
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.
dimitris-athanasiou added a commit that referenced this pull request Nov 23, 2021
…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>
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Nov 23, 2021
…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>
elasticsearchmachine pushed a commit that referenced this pull request Nov 23, 2021
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:ml Machine learning >non-issue Team:ML Meta label for the ML team v8.0.0-rc1 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants