Skip to content

Commit 087e31a

Browse files
author
andrewor14
committed
[HOT FIX] Yarn stable tests don't compile
This is caused by this commit: acd4ac7 Author: andrewor14 <[email protected]> Author: Andrew Or <[email protected]> Closes #3041 from andrewor14/yarn-hot-fix and squashes the following commits: e5deba1 [andrewor14] Add new line at the end (minor) aa998e8 [Andrew Or] Compilation hot fix
1 parent 55ab777 commit 087e31a

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

yarn/common/src/main/scala/org/apache/spark/deploy/yarn/YarnAllocator.scala

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ private[yarn] abstract class YarnAllocator(
6464
securityMgr: SecurityManager)
6565
extends Logging {
6666

67+
import YarnAllocator._
68+
6769
// These three are locked on allocatedHostToContainersMap. Complementary data structures
6870
// allocatedHostToContainersMap : containers which are running : host, Set<containerid>
6971
// allocatedContainerToHostMap: container to host mapping.
@@ -439,19 +441,6 @@ private[yarn] abstract class YarnAllocator(
439441
}
440442
}
441443

442-
private val MEM_REGEX = "[0-9.]+ [KMG]B"
443-
private val PMEM_EXCEEDED_PATTERN =
444-
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX physical memory used")
445-
private val VMEM_EXCEEDED_PATTERN =
446-
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX virtual memory used")
447-
448-
def memLimitExceededLogMessage(diagnostics: String, pattern: Pattern): String = {
449-
val matcher = pattern.matcher(diagnostics)
450-
val diag = if (matcher.find()) " " + matcher.group() + "." else ""
451-
("Container killed by YARN for exceeding memory limits." + diag
452-
+ " Consider boosting spark.yarn.executor.memoryOverhead.")
453-
}
454-
455444
protected def allocatedContainersOnHost(host: String): Int = {
456445
var retval = 0
457446
allocatedHostToContainersMap.synchronized {
@@ -532,3 +521,18 @@ private[yarn] abstract class YarnAllocator(
532521
}
533522

534523
}
524+
525+
private object YarnAllocator {
526+
val MEM_REGEX = "[0-9.]+ [KMG]B"
527+
val PMEM_EXCEEDED_PATTERN =
528+
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX physical memory used")
529+
val VMEM_EXCEEDED_PATTERN =
530+
Pattern.compile(s"$MEM_REGEX of $MEM_REGEX virtual memory used")
531+
532+
def memLimitExceededLogMessage(diagnostics: String, pattern: Pattern): String = {
533+
val matcher = pattern.matcher(diagnostics)
534+
val diag = if (matcher.find()) " " + matcher.group() + "." else ""
535+
("Container killed by YARN for exceeding memory limits." + diag
536+
+ " Consider boosting spark.yarn.executor.memoryOverhead.")
537+
}
538+
}

yarn/common/src/test/scala/org/apache/spark/deploy/yarn/YarnAllocatorSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.spark.deploy.yarn
1919

20-
import org.apache.spark.deploy.yarn.MemLimitLogger._
20+
import org.apache.spark.deploy.yarn.YarnAllocator._
2121
import org.scalatest.FunSuite
2222

2323
class YarnAllocatorSuite extends FunSuite {
@@ -31,4 +31,4 @@ class YarnAllocatorSuite extends FunSuite {
3131
assert(vmemMsg.contains("5.8 GB of 4.2 GB virtual memory used."))
3232
assert(pmemMsg.contains("2.1 MB of 2 GB physical memory used."))
3333
}
34-
}
34+
}

0 commit comments

Comments
 (0)