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

Add create rollup job api to high level rest client #32703

Closed

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Aug 8, 2018

This pull request adds the Create Rollup Job API to the high level REST client.

Related #29827

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

*/
package org.elasticsearch.xpack.core.rollup;
package org.elasticsearch.protocol.xpack.rollup;
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: I moved RollupField along with the rollup configuration objects as it is used in their toBuilders() and getMetadata() methods. I created #32585 and #32579 to remove these two methods from the config objects but we didn't reach a consensus on it (see @polyfractal #32585 (comment)) so any opinion on this is welcome. I don't think it's blocking the PR either.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still mulling this over, but after seeing how it integrates in HLRC (namely, being moved to protocol package) I'm thinking it may be better to separate from the config object despite my earlier objections.

The HLRC will require yet another package to keep updated (xpack.rollup, xpack.core, xpack.protocol and the HLRC itself). So probably best to just move toBuilders() and getMetadata() into the rollup package. The logic will still be spread out, but won't require hunting across multiple packages at least.

Thoughts?

I agree it's not blocking though

@@ -119,7 +131,7 @@ public RollupJobConfig(final String id,
// Cron doesn't have a parse helper method to see if the cron is valid,
// so just construct a temporary cron object and if the cron is bad, it'll
// throw an exception
Cron testCron = new Cron(cron);
//Cron testCron = new Cron(cron);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: here Cron is used to validate the cron expression when instanciating the RollupJobConfig. Maybe this validation could be done on the server side (transport action)? Or should we bring Cron in the common lib?

Copy link
Contributor

Choose a reason for hiding this comment

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

For ML we had the same problem only much, much worse: to reproduce all our server-side config validation in the HLRC would mean moving several classes you'd expect to be server-side only into the protocol library. We decided not to do complex validation client-side to avoid moving such classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

++ to moving this "validation" to the transport action, and adding a TODO to make an actual validation method at some point instead of this hack.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I moved the validation to the transport action

@tlrx
Copy link
Member Author

tlrx commented Aug 8, 2018

@hub-cap I left two comments I'd like to have your opinion on.

@tlrx tlrx requested a review from polyfractal August 8, 2018 07:20
this.config = config;
}

public PutRollupJobRequest() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to worry about this empty ctor now? E.g. if the user uses this instead of the other ctor we'll be throwing NPEs everywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sadly this public ctor is required because of the Streamable nature of PutRollupJobRequest and different packages used for the rollup request and the transport action. Maybe I should have used different requests/response objects for the HLRC since the beginning. It seems that ML did this in the PutJobRequest, but I had the assumption that we were trying to reuse the same objects if possible. For this PutRollupJobRequest I added a check for the configuration in the validate() method, just in case :)

I think PutWatchRequest/DeleteWatchRequest have a similar issue, providing a public ctor but not preventing any resulting NPEs. We may want to change that but I'd defer to Nik/Baz about this.

@polyfractal
Copy link
Contributor

Left a few comments but the rollup'y side LGTM

@tlrx tlrx force-pushed the add-create-rollup-job-api-to-high-level-client branch from bb329b5 to 2f340dd Compare August 13, 2018 18:13
@tlrx tlrx requested a review from nik9000 August 14, 2018 08:24
@tlrx
Copy link
Member Author

tlrx commented Aug 14, 2018

@elasticmachine test this please

@hub-cap
Copy link
Contributor

hub-cap commented Aug 27, 2018

Hi @tlrx. We decided to split the request and response from the ones used in server/x-pack, so they do not overlap. Please update your PR such that you create new request implements Validatable & generic response class in the high level rest client's org.elasticsearch.client.nameOfYourClient. Example: o.e.client.watcher, o.e.client.cluster. Please revert any work you did to modify the existing request/response in x-pack or server.

@tlrx
Copy link
Member Author

tlrx commented Sep 7, 2018

Superseded by #33521

@tlrx tlrx closed this Sep 7, 2018
tlrx added a commit to tlrx/elasticsearch that referenced this pull request Sep 12, 2018
This pull request adds the Create Rollup Job API to the high level REST
client. It supersedes elastic#32703 and adds dedicated request/response
objects so that it does not depend on server side components.

Related elastic#29827
tlrx added a commit that referenced this pull request Sep 17, 2018
This commit adds the Create Rollup Job API to the high level REST
client. It supersedes #32703 and adds dedicated request/response
objects so that it does not depend on server side components.

Related #29827
@tlrx tlrx deleted the add-create-rollup-job-api-to-high-level-client branch September 17, 2018 07:34
tlrx added a commit that referenced this pull request Sep 17, 2018
This commit adds the Create Rollup Job API to the high level REST
client. It supersedes #32703 and adds dedicated request/response
objects so that it does not depend on server side components.

Related #29827
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 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