Uh oh!
There was an error while loading. Please reload this page.
[SPARK-26726] Synchronize the amount of memory used by the broadcast variable to the UI display - #23649
[SPARK-26726] Synchronize the amount of memory used by the broadcast variable to the UI display#23649httfighter wants to merge 7 commits into
Conversation
…not synchronized to the UI display
| } | ||
| } | ||
| def updateBroadcastBlock(event: SparkListenerBlockUpdated, broadcast: BroadcastBlockId): Unit = { |
There was a problem hiding this comment.
Thank you for your review! I have submitted a new change.
dongjoon-hyun
commented
Jan 25, 2019
Hi, @httfighter . |
vanzin
commented
Jan 25, 2019
It's not really a UI PR. But it does need a unit test. |
httfighter
commented
Jan 28, 2019
@vanzin Thank you for your review! I have added the test case. |
@dongjoon-hyun Memory usage for the broadcast variable will not be updated synchronously in the UI before modification. After the modification, the memory usage for the broadcast variable will be updated synchronously in the UI. |
vanzin
left a comment
There was a problem hiding this comment.
Please use the PR title/description to explain the fix, not the problem.
| } | ||
| } | ||
| private def updateBroadcastBlock(event: SparkListenerBlockUpdated, |
There was a problem hiding this comment.
multi line args start on the next line.
| val memoryDelta = event.blockUpdatedInfo.memSize * (if (storageLevel.useMemory) 1 else -1) | ||
| // Function to apply a delta to a value, but ensure that it doesn't go negative. | ||
| def newValue(old: Long, delta: Long): Long = math.max(0, old + delta) |
There was a problem hiding this comment.
Already exists (addDeltaToValue).
| val maybeExec = liveExecutors.get(executorId) | ||
| maybeExec.foreach { exec => | ||
| if (exec.hasMemoryInfo) { |
There was a problem hiding this comment.
This block exists in a very similar form in two other places. Feels like time to have a helper method.
httfighter
commented
Jan 29, 2019
@vanzin Thanks for your advice. I have updated the code. |
vanzin
left a comment
There was a problem hiding this comment.
Your PR title still explains the problem, not the fix.
| } | ||
| // update executor memory and disk usage info |
There was a problem hiding this comment.
This just repeats the method name. Remove.
| storageLevel: StorageLevel, | ||
| memoryDelta: Long, | ||
| diskDelta: Long, | ||
| OffHeapDelta: Option[Long], |
There was a problem hiding this comment.
Variable names start with lower case.
I'd also avoid the Option here. That causes extra allocations + boxing which this code should avoid.
In the broadcast update you could just repeat memoryDelta as the parameter, since that's what this boils down to...
| diskDelta: Long, | ||
| OffHeapDelta: Option[Long], | ||
| OnHeapDelta: Option[Long]): Unit = { | ||
| maybeExec.foreach { exec => |
There was a problem hiding this comment.
Move the foreach to the caller. That avoids repeating the foreach, and you could wrap more logic that doesn't need to run when the executor is not found.
httfighter
commented
Jan 30, 2019
@vanzin OK. Please help me review it again. |
vanzin
commented
Jan 30, 2019
ok to test |
| val diskDelta = event.blockUpdatedInfo.diskSize * (if (storageLevel.useDisk) 1 else -1) | ||
| val memoryDelta = event.blockUpdatedInfo.memSize * (if (storageLevel.useMemory) 1 else -1) | ||
| liveExecutors.get(executorId).foreach { exec => |
There was a problem hiding this comment.
All the code above can be moved within the foreach.
There was a problem hiding this comment.
@vanzin Yes! It is true. I have updated the code.
SparkQA
commented
Jan 30, 2019
Test build #101904 has finished for PR 23649 at commit
|
SparkQA
commented
Jan 31, 2019
Test build #101925 has finished for PR 23649 at commit
|
vanzin
commented
Jan 31, 2019
Merging to master / 2.4. |
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
vanzin
commented
Jan 31, 2019
It was a clean backport to 2.3 and passed tests, so also merged to 2.3. |
dongjoon-hyun
commented
Jan 31, 2019
It's great! And, cc @maropu . |
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closesapache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closesapache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closesapache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closesapache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <han.tiantian@zte.com.cn> Co-authored-by: han.tiantian@zte.com.cn <han.tiantian@zte.com.cn> Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>


…not synchronized to the UI display
What changes were proposed in this pull request?
The amount of memory used by the broadcast variable is not synchronized to the UI display.
I added the case for BroadcastBlockId and updated the memory usage.
How was this patch tested?
We can test this patch with unit tests.