Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,10 @@ private[spark] class ExecutorAllocationManager(
if (testing || executorsRemoved.nonEmpty) {
executorsRemoved.foreach { removedExecutorId =>
newExecutorTotal -= 1
val hasCachedBlocks = SparkEnv.get.blockManager.master.hasCachedBlocks(removedExecutorId)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a pretty expensive call just so you can print a more accurate log message... at the very least it should be inside the logInfo call:

logInfo {
  expensiveStuff()
  "This is the log message referencing the expensive stuff."
}

But I'd prefer a solution that doesn't make this call at all, since INFO is more often than not enabled.

val timeout = if (hasCachedBlocks) cachedExecutorIdleTimeoutS else executorIdleTimeoutS
logInfo(s"Removing executor $removedExecutorId because it has been idle for " +
s"$executorIdleTimeoutS seconds (new desired total will be $newExecutorTotal)")
s"${if (SparkEnv.get.blockManager.master.hasCachedBlocks(executorId)) cachedExecutorIdleTimeoutS else executorIdleTimeoutS} seconds (new desired total will be $newExecutorTotal)")
Copy link
Member

Choose a reason for hiding this comment

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

This is hard to read. @vanzin 's idea is better. Can you split this into two statements? cheap one at info, expensive one at debug?

executorsPendingToRemove.add(removedExecutorId)
}
executorsRemoved
Expand Down