-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] make more GET and heavier processing APIs cancellable #88142
[ML] make more GET and heavier processing APIs cancellable #88142
Conversation
Pinging @elastic/ml-core (Team:ML) |
36e1e06
to
f83534e
Compare
@@ -30,6 +45,118 @@ private ExplainDataFrameAnalyticsAction() { | |||
super(NAME, ExplainDataFrameAnalyticsAction.Response::new); | |||
} | |||
|
|||
public static class Request extends AcknowledgedRequest<Request> implements ToXContentObject { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this request object (just a copy of PutDataFrameAnalytics
) as the PUT object was being reused here, but I didn't want to make that request's task cancellable (as PUT isn't cancellable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I added a BWC test for explain
in a mixed cluster to ensure this doesn't break anything. Ran it many many times and its all good since the explain request and the put request can be serialized to each other without issue.
@@ -101,13 +102,14 @@ protected void doExecute(Task task, Request request, ActionListener<Response> li | |||
} | |||
|
|||
void preview(Task task, DataFrameAnalyticsConfig config, ActionListener<Response> listener) { | |||
final TaskId parentTaskId = new TaskId(clusterService.getNodeName(), task.getId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if task.getParentTaskId()
was strictly correct. task
is indeed the transport action task (created via our request object) that is being executed here. It SHOULD have a parent task that is the original HTTP request (I think?) but it seems that the prevailing pattern is to rely on this task
object instead of its parent.
@@ -131,7 +135,7 @@ private void previewDatafeed( | |||
// requesting the preview doesn't have permission to search the relevant indices. | |||
DatafeedConfig previewDatafeedConfig = previewDatafeedBuilder.build(); | |||
DataExtractorFactory.create( | |||
new ParentTaskAssigningClient(client, clusterService.localNode(), task), | |||
new ParentTaskAssigningClient(client, parentTaskId), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a nice idea, but since the task being created by the request was never cancellable (and neither was the http request), the cascade effect of cancellations was missed :/
f83534e
to
bd28f76
Compare
@elasticmachine update branch |
@elasticmachine update branch |
...gin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetModelSnapshotsAction.java
Outdated
Show resolved
Hide resolved
...gin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportGetModelSnapshotsAction.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/JobManager.java
Outdated
Show resolved
Hide resolved
Co-authored-by: David Roberts <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@elasticmachine update branch |
This commit makes the following APIs cancellable: