Skip to content

Commit e933ef6

Browse files
Luan, Xuedongmingmwang
authored andcommitted
[CARMEL-3499] Change vCores to 1 in ContainerRequest for hadoop limit (#17)
* [CARMEL-3499] Change vCores to 1 in ContainerRequest for hadoop limit * change the default value of DEFAULT_RESOURCE_CALCULATOR to false
1 parent 171868b commit e933ef6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,9 @@ private[yarn] class YarnAllocator(
406406
resource: Resource,
407407
nodes: Array[String],
408408
racks: Array[String]): ContainerRequest = {
409+
if (sparkConf.get(DEFAULT_RESOURCE_CALCULATOR)) {
410+
resource.setVirtualCores(1)
411+
}
409412
new ContainerRequest(resource, nodes, racks, RM_REQUEST_PRIORITY, true, labelExpression.orNull)
410413
}
411414

resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/config.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@ package object config {
178178
.timeConf(TimeUnit.MILLISECONDS)
179179
.createWithDefaultString("1s")
180180

181+
private[spark] val DEFAULT_RESOURCE_CALCULATOR =
182+
ConfigBuilder("spark.yarn.scheduler.default.resource.calculator")
183+
.doc("After enable default resource calculator, the value of vCores " +
184+
"in ContainerRequest is always 1.")
185+
.booleanConf
186+
.createWithDefault(false)
187+
181188
/* Shared Client-mode AM / Driver configuration. */
182189

183190
private[spark] val AM_MAX_WAIT_TIME = ConfigBuilder("spark.yarn.am.waitTime")

0 commit comments

Comments
 (0)