[LIVY-758] Document how to attach to an existing session from Java client#290
[LIVY-758] Document how to attach to an existing session from Java client#290tmnd1991 wants to merge 6 commits into
Conversation
|
I could not assign myself the relate jira, how can I do it? @mgaido91 @vanzin @jerryshao |
|
@tmnd1991 you can't, JIRAs are assigned when related patches are merged and they are resolved |
|
|
||
| private static final ServiceLoader<LivyClientFactory> CLIENT_FACTORY_LOADER = | ||
| ServiceLoader.load(LivyClientFactory.class, classLoader()); | ||
| ServiceLoader.load(LivyClientFactory.class, classLoader()); |
There was a problem hiding this comment.
nit: unneeded change, please revert
| * @param uri the uri of the livy server, | ||
| * if the uri contains <pre>sessions/{sessionId}</pre> | ||
| * the client will connect to the existing session, | ||
| * otherwise it will create a new session. |
There was a problem hiding this comment.
| * @param uri the uri of the livy server, | |
| * if the uri contains <pre>sessions/{sessionId}</pre> | |
| * the client will connect to the existing session, | |
| * otherwise it will create a new session. | |
| * @param uri The URI of Livy server. If the URI contains <pre>sessions/{sessionId}</pre>, | |
| * the client will connect to the specified existing session, otherwise it will create a | |
| * new session. |
| * if the uri contains <pre>sessions/{sessionId}</pre> | ||
| * the client will connect to the existing session, | ||
| * otherwise it will create a new session. | ||
| * @return the builder itself. |
There was a problem hiding this comment.
| * @return the builder itself. | |
| * @return The builder itself. |
| * @param sessionId the id of the session to attach to, | ||
| * if not set a new session will be created when the client is built. |
There was a problem hiding this comment.
| * @param sessionId the id of the session to attach to, | |
| * if not set a new session will be created when the client is built. | |
| * @param sessionId The ID of the session to attach to. If not set, a new | |
| * session will be created when the client is built. |
| * @return the builder itself. | ||
| */ | ||
| public LivyClientBuilder setSessionId(int sessionId) { | ||
| config.setProperty(LIVY_SESSION_ID_KEY, "" + sessionId); |
There was a problem hiding this comment.
| config.setProperty(LIVY_SESSION_ID_KEY, "" + sessionId); | |
| config.setProperty(LIVY_SESSION_ID_KEY, String.valueOf(sessionId)); |
| Matcher m = Pattern.compile("(.*)" + LivyConnection.SESSIONS_URI + "/([0-9]+)") | ||
| .matcher(uri.getPath()); | ||
|
|
||
| Matcher m = Pattern.compile("(.*)" + LivyConnection.SESSIONS_URI + "/([0-9]+)").matcher(uri.getPath()); |
There was a problem hiding this comment.
why did you remove the comment above? moreover, here I see no changes, so please revert the change to keep the history clean
There was a problem hiding this comment.
I did it because the in-line comment was the only doc about connecting to an existing session. Now that is documented in the builder I don't think the inline comment is still needed, anyway no problem at all at reverting that change.
| URI base = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), | ||
| m.group(1), uri.getQuery(), uri.getFragment()); | ||
|
|
||
| m.group(1), uri.getQuery(), uri.getFragment()); |
There was a problem hiding this comment.
please revert unneeded change
Then I think contributing section is wrong :) |
09cd522 to
8659ab9
Compare
…ient and add a property to the builder
8659ab9 to
682cec4
Compare
|
I changed what you suggested @mgaido91 , thanks for the review. |
|
@mgaido91 I think your mixing up how Spark handles JIRA assignments with Livy's policy. We assign JIRAs once a PR is open for the issue. For some reason though, I can't assign issues to @tmnd1991 in the Livy JIRA at the moment. We had this issue before but I can't remember how we solved it. @tmnd1991 A heads up, when you force push updates to commits it makes it difficult to track your changes as you address review (eg. I can't tell which of @mgaido91 comments you've addressed because there's no history to compare to). Since we squash all commits in a PR before merging the quantity of commits in a PR isn't an issue. As for your code, I read through it and I don't see any issues with the current code, but I don't have to time check it out and more thoroughly test it so I will defer to @mgaido91 on final approval for this PR. |
Good, I did not know if the squash before merge was a "thing" in Livy repo, I won't do the same mistake again :)
👍 |
Sorry, I saw the same pattern being followed in Livy too in practice so I assumed it was the same. I think the point is that @tmnd1991 has to be added to the contributors in JIRA. I'll do that when resolving the JIRA. |
mgaido91
left a comment
There was a problem hiding this comment.
LGTM apart from some wordings.
Co-Authored-By: Marco Gaido <marcogaido91@gmail.com>
Co-Authored-By: Marco Gaido <marcogaido91@gmail.com>
Co-Authored-By: Marco Gaido <marcogaido91@gmail.com>
Co-Authored-By: Marco Gaido <marcogaido91@gmail.com>
|
|
||
| /** | ||
| * Sets the URI of the Livy server the client will connect to. If the URI contains | ||
| * <pre>sessions/{sessionId}</pre>, the client will connect to the specified existing session; |
There was a problem hiding this comment.
one last question: @ajbozarth @jerryshao @tmnd1991 I think that by adding this API, we might want to deprecate this "hacky" approach and eventually remove the support to it in next major release. Any thought on this?
There was a problem hiding this comment.
I 100% agree on removing the hacky (and until now not even documented) approach. I left it to make the PR backward compatible
There was a problem hiding this comment.
yes, we definitely need to leave it for now, but we can start deprecating it. Let's wait for others opinion .
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #290 +/- ##
============================================
+ Coverage 68.19% 68.36% +0.16%
- Complexity 964 970 +6
============================================
Files 104 104
Lines 5952 5961 +9
Branches 900 902 +2
============================================
+ Hits 4059 4075 +16
+ Misses 1314 1306 -8
- Partials 579 580 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
What changes were proposed in this pull request?
Add an explicit way to set the session when connecting from the Java client.
https://issues.apache.org/jira/browse/LIVY-758
How was this patch tested?
Unit tested through
HttpClientSpec.