Skip to content
Closed
Show file tree
Hide file tree
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 @@ -54,7 +54,8 @@ private[yarn] class ExecutorRunnable(
executorCores: Int,
appId: String,
securityMgr: SecurityManager,
localResources: Map[String, LocalResource]) extends Logging {
localResources: Map[String, LocalResource]
allocationMeter: Int) extends Logging {

var rpc: YarnRPC = YarnRPC.create(conf)
var nmClient: NMClient = _
Expand Down Expand Up @@ -207,8 +208,12 @@ private[yarn] class ExecutorRunnable(
}.toSeq

YarnSparkHadoopUtil.addOutOfMemoryErrorArgument(javaOpts)

//sparkConf.get(NUMA_NODE)
val numaNode = allocationMeter%2

val commands = prefixEnv ++ Seq(
YarnSparkHadoopUtil.expandEnvironment(Environment.JAVA_HOME) + "/bin/java",
s" numactl --cpunodebind=$numaNode --preferred=$numaNode " + YarnSparkHadoopUtil.expandEnvironment(Environment.JAVA_HOME) + "/bin/java",
"-server") ++
javaOpts ++
Seq("org.apache.spark.executor.CoarseGrainedExecutorBackend",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ private[yarn] class YarnAllocator(
private var numUnexpectedContainerRelease = 0L
private val containerIdToExecutorId = new HashMap[ContainerId, String]

// Keep track already allocated executor per host
val hostToAllocationMeterMap = new HashMap[String, Int]

// Executor memory in MB.
protected val executorMemory = sparkConf.get(EXECUTOR_MEMORY).toInt
// Additional memory overhead.
Expand Down Expand Up @@ -507,6 +510,10 @@ private[yarn] class YarnAllocator(

if (numExecutorsRunning < targetNumExecutors) {
if (launchContainers) {

val allocationMeter = hostToAllocationMeterMap.getOrElseUpdate(executorHostname, 0)
hostToAllocationMeterMap.put(executorHostname, allocationMeter + 1)

launcherPool.execute(new Runnable {
override def run(): Unit = {
try {
Expand All @@ -521,7 +528,8 @@ private[yarn] class YarnAllocator(
executorCores,
appAttemptId.getApplicationId.toString,
securityMgr,
localResources
localResources,
allocationMeter
).run()
updateInternalState()
} catch {
Expand Down