@@ -64,6 +64,8 @@ private[yarn] abstract class YarnAllocator(
64
64
securityMgr : SecurityManager )
65
65
extends Logging {
66
66
67
+ import YarnAllocator ._
68
+
67
69
// These three are locked on allocatedHostToContainersMap. Complementary data structures
68
70
// allocatedHostToContainersMap : containers which are running : host, Set<containerid>
69
71
// allocatedContainerToHostMap: container to host mapping.
@@ -439,19 +441,6 @@ private[yarn] abstract class YarnAllocator(
439
441
}
440
442
}
441
443
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
-
455
444
protected def allocatedContainersOnHost (host : String ): Int = {
456
445
var retval = 0
457
446
allocatedHostToContainersMap.synchronized {
@@ -532,3 +521,18 @@ private[yarn] abstract class YarnAllocator(
532
521
}
533
522
534
523
}
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
+ }
0 commit comments