-
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
Support assert in Painless #20264
Comments
I'll take a look into adding this early next week. I don't think it should be too difficult. |
Thinking out loud, will this asset be always on like groove's assert or On Aug 31, 2016 7:57 PM, "Jack Conradson" notifications@github.com wrote:
|
I think that's what |
@nik9000 @jasontedor Using |
My instinct would be to make a |
@nik9000 I'm good with this solution. Thanks for the suggestion! |
Working through this -- after speaking with @rjernst ideally we need a way to disable asserts so they end up being no-ops. I can see three ways of addressing options:
|
Yeah, I agree with the noop thing. Can it be done with the compilation On Sep 7, 2016 7:34 PM, "Jack Conradson" notifications@github.com wrote:
|
@nik9000 There is a <String,String> map in compile that we added to be able to remove a custom script engine that wasn't otherwise necessary. There are a couple other issues that need to be solved depending on the route we go. Global versus script-only options, are they all one or the other? (Both even?) And, will there be any issues with caching since if we don't go with option one, something like asserts used versus being a no-op requires a re-compile. |
Right. That map probably needs to be part of the cache key in addition to any other plumbing we'd have to do if we used the map. |
I really like the idea of being able to enable/disable asserts per script, eg with the options at the beginning of the script. Typically you want to debug a single script, rather than turning on asserts for all scripts in your cluster. |
Right. I was thinking something like:
|
I would prefer just adding the options to the beginning of the script because it requires no change to the REST API, and naturally fits the existing cache without modification. This isolates the change to only Painless. I also understand there's a bit of plumbing for options (as I had done this work), but this was mostly so we could remove the customized Mustache engine and only have one. |
to me this is all a question of how do we expose this. I had a chat with @jdconrad and @rjernst the other day about
If we'd do this we can develop these features in isolation, ie add asserts and logging to painless and expose it separately which I'd prefer. |
This sounds like we'd need to add a new API for every script calling context. I think that dovetails well with the more strict registration of search contexts that came up in #20426 but I'm a bit weary of adding so many APIs. |
Discussed with @jdconrad, @s1monw , @rjernst, and @nik9000 - current plan is to add a |
Closing this as Debug.explain can serve this purpose. Discussion around tools for Painless is proceeding in other issues. |
Similar to #20263, but as a simplification of the process for throwing an exception. If we do choose to allow assertions, then we should only allow them in the form that supplies a string with them.
This would make it easier for end users to throw exceptions without having to try to figure out what exception(s) are supported.
The text was updated successfully, but these errors were encountered: