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

[LIVY-336][SERVER] Livy should not spawn one thread per job to track the job on Yarn #242

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

runzhiwang
Copy link
Contributor

What changes were proposed in this pull request?

Instead of spawning a monitor thread for every session, create a centralized thread to monitor all apps.

How was this patch tested?

Existed ITs and UTs.

@codecov-io
Copy link

codecov-io commented Oct 6, 2019

Codecov Report

Merging #242 into master will increase coverage by 0.14%.
The diff coverage is 77.14%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #242      +/-   ##
============================================
+ Coverage     68.09%   68.23%   +0.14%     
- Complexity      939      949      +10     
============================================
  Files           102      102              
  Lines          5883     5935      +52     
  Branches        893      904      +11     
============================================
+ Hits           4006     4050      +44     
- Misses         1302     1310       +8     
  Partials        575      575
Impacted Files Coverage Δ Complexity Δ
...rver/src/main/scala/org/apache/livy/LivyConf.scala 96.07% <100%> (+0.05%) 21 <0> (ø) ⬇️
...ain/scala/org/apache/livy/utils/SparkYarnApp.scala 76.07% <76.47%> (+1.07%) 50 <7> (+10) ⬆️
...cala/org/apache/livy/scalaapi/ScalaJobHandle.scala 52.94% <0%> (-2.95%) 7% <0%> (ø)
...c/src/main/java/org/apache/livy/rsc/RSCClient.java 73.49% <0%> (+1.2%) 20% <0%> (ø) ⬇️
...ala/org/apache/livy/scalaapi/LivyScalaClient.scala 86.66% <0%> (+3.33%) 7% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 319386a...3144ff1. Read the comment docs.

Copy link
Contributor

@jahstreet jahstreet left a comment

Choose a reason for hiding this comment

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

Nice PR proposal, it should have been done long time ago) Added some comments. I see that improvements that can be done here with rearranging code a bit. Would you mind if I propose some changes on to your branch?
Suggestions: runzhiwang#1

@runzhiwang runzhiwang force-pushed the merge-monitor-thread branch 2 times, most recently from 8839fb4 to f949f66 Compare November 8, 2019 09:30
@runzhiwang
Copy link
Contributor Author

@jahstreet Thank you for your comments. I have updated the PR.

@jahstreet
Copy link
Contributor

@runzhiwang Yeah, I see, will go through once again during weekend. Good job man!

@runzhiwang runzhiwang closed this Nov 12, 2019
@runzhiwang runzhiwang reopened this Nov 12, 2019
@runzhiwang runzhiwang force-pushed the merge-monitor-thread branch 2 times, most recently from 01a445e to 2b38d51 Compare November 12, 2019 09:17
@jerryshao
Copy link
Contributor

I still need a close look to see the detailed implementations.

@runzhiwang runzhiwang changed the title [LIVY-336] Livy should not spawn one thread per job to track the job on Yarn [LIVY-336][WIP] Livy should not spawn one thread per job to track the job on Yarn Nov 19, 2019
@jerryshao
Copy link
Contributor

I'm OK with the current changes, @yiheng would you please also take a look.

@runzhiwang runzhiwang force-pushed the merge-monitor-thread branch 5 times, most recently from ce12169 to 61d5d38 Compare November 22, 2019 00:43
@jerryshao
Copy link
Contributor

Looks ok from my side, @yiheng please help to review again.

@runzhiwang runzhiwang changed the title [LIVY-336][WIP] Livy should not spawn one thread per job to track the job on Yarn [LIVY-336] Livy should not spawn one thread per job to track the job on Yarn Nov 22, 2019
@runzhiwang runzhiwang changed the title [LIVY-336] Livy should not spawn one thread per job to track the job on Yarn [LIVY-336][Server] Livy should not spawn one thread per job to track the job on Yarn Nov 22, 2019
@runzhiwang runzhiwang changed the title [LIVY-336][Server] Livy should not spawn one thread per job to track the job on Yarn [LIVY-336][SERVER] Livy should not spawn one thread per job to track the job on Yarn Nov 22, 2019
@runzhiwang runzhiwang force-pushed the merge-monitor-thread branch 3 times, most recently from 12ebee8 to b18fad1 Compare November 29, 2019 07:19
@runzhiwang runzhiwang force-pushed the merge-monitor-thread branch from 24561ab to c3c86e3 Compare December 6, 2019 07:01
Copy link
Contributor

@jahstreet jahstreet left a comment

Choose a reason for hiding this comment

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

Added some comments, other than that looks nice so far, good job!

@runzhiwang
Copy link
Contributor Author

@jahstreet Thank you very much, I have updated according to your comments.

@jahstreet
Copy link
Contributor

@runzhiwang can you test your patch on a Yarn cluster?

@runzhiwang
Copy link
Contributor Author

@jahstreet OK.

@runzhiwang
Copy link
Contributor Author

@jahstreet Hi, I have test the patch, and it works fine.

Thread.sleep(yarnPoolInterval)
} catch {
case e: InterruptedException =>
loop = false
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep in the loop? I'm afraid the thread is interrupted while the livy is still running. Then all the app status won't change.

@sanchay0
Copy link

Hey @runzhiwang what's the status of this PR? Are you going to merge this in? I'm having issues with dangling threads with a lot of jobs running simultaneously and this fix will be great to have!

@runzhiwang
Copy link
Contributor Author

runzhiwang commented Apr 16, 2020

@sanchay0 Thanks for your attention. I have completed the code. And It just need more review.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 77.14286% with 24 lines in your changes missing coverage. Please review.

Project coverage is 68.23%. Comparing base (0a527e8) to head (3144ff1).
Report is 64 commits behind head on master.

Files with missing lines Patch % Lines
...ain/scala/org/apache/livy/utils/SparkYarnApp.scala 76.47% 17 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #242   +/-   ##
=========================================
  Coverage     68.23%   68.23%           
- Complexity      941      949    +8     
=========================================
  Files           102      102           
  Lines          5883     5935   +52     
  Branches        893      904   +11     
=========================================
+ Hits           4014     4050   +36     
- Misses         1295     1310   +15     
- Partials        574      575    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants