Skip to content

Conversation

@httfighter
Copy link
Contributor

@httfighter httfighter commented Jan 25, 2019

…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.

}
}

def updateBroadcastBlock(event: SparkListenerBlockUpdated, broadcast: BroadcastBlockId): Unit = {
Copy link
Member

Choose a reason for hiding this comment

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

def -> private def?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review! I have submitted a new change.

@dongjoon-hyun
Copy link
Member

Hi, @httfighter .
Since this is UI PR, could you attach the screenshots of BEFORE and AFTER?

@vanzin
Copy link
Contributor

vanzin commented Jan 25, 2019

It's not really a UI PR. But it does need a unit test.

@httfighter
Copy link
Contributor Author

@vanzin Thank you for your review! I have added the test case.

@httfighter
Copy link
Contributor Author

httfighter commented Jan 28, 2019

@dongjoon-hyun Memory usage for the broadcast variable will not be updated synchronously in the UI before modification.
image

After the modification, the memory usage for the broadcast variable will be updated synchronously in the UI.
image

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Please use the PR title/description to explain the fix, not the problem.

}
}

private def updateBroadcastBlock(event: SparkListenerBlockUpdated,
Copy link
Contributor

Choose a reason for hiding this comment

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

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Already exists (addDeltaToValue).


val maybeExec = liveExecutors.get(executorId)
maybeExec.foreach { exec =>
if (exec.hasMemoryInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This block exists in a very similar form in two other places. Feels like time to have a helper method.

@httfighter
Copy link
Contributor Author

@vanzin Thanks for your advice. I have updated the code.

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Your PR title still explains the problem, not the fix.


}

// update executor memory and disk usage info
Copy link
Contributor

Choose a reason for hiding this comment

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

This just repeats the method name. Remove.

storageLevel: StorageLevel,
memoryDelta: Long,
diskDelta: Long,
OffHeapDelta: Option[Long],
Copy link
Contributor

Choose a reason for hiding this comment

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

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 =>
Copy link
Contributor

Choose a reason for hiding this comment

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

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 httfighter changed the title [SPARK-26726] The amount of memory used by the broadcast variable is … [SPARK-26726] Synchronize the amount of memory used by the broadcast variable to the UI display Jan 30, 2019
@httfighter
Copy link
Contributor Author

@vanzin OK. Please help me review it again.

@vanzin
Copy link
Contributor

vanzin commented Jan 30, 2019

ok to test

Copy link
Contributor

@vanzin vanzin left a comment

Choose a reason for hiding this comment

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

Looks good pending tests.

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 =>
Copy link
Contributor

Choose a reason for hiding this comment

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

All the code above can be moved within the foreach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vanzin Yes! It is true. I have updated the code.

@SparkQA
Copy link

SparkQA commented Jan 30, 2019

Test build #101904 has finished for PR 23649 at commit 221bf77.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 31, 2019

Test build #101925 has finished for PR 23649 at commit 2024976.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Jan 31, 2019

Merging to master / 2.4.

@asfgit asfgit closed this in f4a17e9 Jan 31, 2019
asfgit pushed a commit that referenced this pull request Jan 31, 2019
…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 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
(cherry picked from commit f4a17e9)
Signed-off-by: Marcelo Vanzin <[email protected]>
asfgit pushed a commit that referenced this pull request Jan 31, 2019
…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 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
(cherry picked from commit f4a17e9)
Signed-off-by: Marcelo Vanzin <[email protected]>
@vanzin
Copy link
Contributor

vanzin commented Jan 31, 2019

It was a clean backport to 2.3 and passed tests, so also merged to 2.3.

@dongjoon-hyun
Copy link
Member

It's great! And, cc @maropu .

jackylee-ch pushed a commit to jackylee-ch/spark that referenced this pull request Feb 18, 2019
…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 apache#23649 from httfighter/SPARK-26726.

Lead-authored-by: 韩田田00222924 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
kai-chi pushed a commit to kai-chi/spark that referenced this pull request Jul 23, 2019
…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 apache#23649 from httfighter/SPARK-26726.

Lead-authored-by: 韩田田00222924 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
(cherry picked from commit f4a17e9)
Signed-off-by: Marcelo Vanzin <[email protected]>
kai-chi pushed a commit to kai-chi/spark that referenced this pull request Jul 25, 2019
…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 apache#23649 from httfighter/SPARK-26726.

Lead-authored-by: 韩田田00222924 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
(cherry picked from commit f4a17e9)
Signed-off-by: Marcelo Vanzin <[email protected]>
kai-chi pushed a commit to kai-chi/spark that referenced this pull request Aug 1, 2019
…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 apache#23649 from httfighter/SPARK-26726.

Lead-authored-by: 韩田田00222924 <[email protected]>
Co-authored-by: [email protected] <[email protected]>
Signed-off-by: Marcelo Vanzin <[email protected]>
(cherry picked from commit f4a17e9)
Signed-off-by: Marcelo Vanzin <[email protected]>
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.

4 participants