Skip to content
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] Data Frame HLRC start & stop APIs #40154

Merged
merged 7 commits into from
Mar 19, 2019

Conversation

davidkyle
Copy link
Member

On the server side both these APIs inherit BaseTasksResponse which returns node failures etc. This PR adds a AcknowledgedTasksResponse for parsing the response.

The TaskOperationFailure class was added in #29546 and the decision was made there not to implement equals & hashcode as the serialisation of ElasticsearchExceptions changes them wrapping the error in an outer exception. This made writing the unit tests a little bit more complicated as a custom equals method was required.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ml-core

@davidkyle
Copy link
Member Author

I pushed a change to add a teardown stopping and deleting transforms to the docs tests.

Also I added parsing the timeout param in RestStartDataFrameTransformAction and removed the TODOs in the HLRC code. I figured the Start Data Frame request extends AcknowledgedRequest request for a good reason so the timeout param should be respected.

@benwtrent can you look over the latest 2 commits please

Copy link
Member

@benwtrent benwtrent left a comment

Choose a reason for hiding this comment

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

Minor things, looks good though .

StartDataFrameTransformAction.Request request = new StartDataFrameTransformAction.Request(id);

if (restRequest.hasParam(DataFrameField.TIMEOUT.getPreferredName())) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this hasParam check is redundant, though it is not hurting anything.

"timeout": {
"type": "time",
"required": false,
"description": "Controls the time to wait for the transform to start"
Copy link
Member

Choose a reason for hiding this comment

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

would be nice to know the default value.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm having second thoughts about this timeout parameter. Get Stats, Preview and Put could all take a timeout parameter as ActionRequests or BaseTasksRequests. Should we actually expose it? Is it helpful to offer this option or confusing? I think it makes sense for Stop and Start (start datafeed and open job both have a timeout parameter). I don't know anymore I'm over-thinking it.

Copy link
Member

Choose a reason for hiding this comment

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

GET stats _preview and PUT should not really have a timeout option (IMO).

_start could be take a long time as it needs to wait for a Node to start executing the task, thus a timeout sort of makes sense.

Addendum, if we include timeout we may also want to include a wait_for_completion or a sync/async option, but that could be another PR and discussion.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that _start and _stop should take a timeout parameter and the others shouldn't. For _start and _stop there will be occasions when the caller wants to know when the state change is complete before they move on to the next operation, yet they probably don't want to wait forever if something goes wrong. Our integration tests are a good example of this need but any user trying to automate an end-to-end process that involves data frames will be in a similar situation. Having a timeout on the _start and _stop endpoints is also consistent with what we do for datafeeds and anomaly detectors.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. Thanks for the 2nd review @benwtrent

@davidkyle davidkyle merged commit 1f62a7a into elastic:master Mar 19, 2019
@davidkyle davidkyle deleted the df-hlrc-stop-api branch March 19, 2019 09:48
davidkyle added a commit to davidkyle/elasticsearch that referenced this pull request Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants