@@ -26,15 +26,15 @@ import org.apache.spark.{SparkConf, SparkException}
26
26
import org .apache .spark .deploy .k8s .Config ._
27
27
import org .apache .spark .deploy .k8s .Constants ._
28
28
import org .apache .spark .deploy .k8s .KubernetesConf
29
- import org .apache .spark .internal .Logging
29
+ import org .apache .spark .internal .SafeLogging
30
30
import org .apache .spark .util .{Clock , Utils }
31
31
32
32
private [spark] class ExecutorPodsAllocator (
33
33
conf : SparkConf ,
34
34
executorBuilder : KubernetesExecutorBuilder ,
35
35
kubernetesClient : KubernetesClient ,
36
36
snapshotsStore : ExecutorPodsSnapshotsStore ,
37
- clock : Clock ) extends Logging {
37
+ clock : Clock ) extends SafeLogging {
38
38
39
39
private val EXECUTOR_ID_COUNTER = new AtomicLong (0L )
40
40
@@ -82,7 +82,7 @@ private[spark] class ExecutorPodsAllocator(
82
82
newlyCreatedExecutors.foreach { case (execId, timeCreated) =>
83
83
val currentTime = clock.getTimeMillis()
84
84
if (currentTime - timeCreated > podCreationTimeout) {
85
- logWarning (s " Executor with id $execId was not detected in the Kubernetes " +
85
+ safeLogWarning (s " Executor with id $execId was not detected in the Kubernetes " +
86
86
s " cluster after $podCreationTimeout milliseconds despite the fact that a " +
87
87
" previous allocation attempt tried to create it. The executor may have been" +
88
88
" deleted but the application missed the deletion event." )
@@ -94,7 +94,7 @@ private[spark] class ExecutorPodsAllocator(
94
94
}
95
95
newlyCreatedExecutors -= execId
96
96
} else {
97
- logDebug (s " Executor with id $execId was not found in the Kubernetes cluster since it " +
97
+ safeLogDebug (s " Executor with id $execId was not found in the Kubernetes cluster since it " +
98
98
s " was created ${currentTime - timeCreated} milliseconds ago. " )
99
99
}
100
100
}
@@ -112,15 +112,15 @@ private[spark] class ExecutorPodsAllocator(
112
112
case _ => false
113
113
}
114
114
val currentTotalExpectedExecutors = totalExpectedExecutors.get
115
- logDebug (s " Currently have $currentRunningExecutors running executors and " +
115
+ safeLogDebug (s " Currently have $currentRunningExecutors running executors and " +
116
116
s " $currentPendingExecutors pending executors. $newlyCreatedExecutors executors " +
117
117
s " have been requested but are pending appearance in the cluster. " )
118
118
if (newlyCreatedExecutors.isEmpty
119
119
&& currentPendingExecutors == 0
120
120
&& currentRunningExecutors < currentTotalExpectedExecutors) {
121
121
val numExecutorsToAllocate = math.min(
122
122
currentTotalExpectedExecutors - currentRunningExecutors, podAllocationSize)
123
- logInfo (s " Going to request $numExecutorsToAllocate executors from Kubernetes. " )
123
+ safeLogInfo (s " Going to request $numExecutorsToAllocate executors from Kubernetes. " )
124
124
for ( _ <- 0 until numExecutorsToAllocate) {
125
125
val newExecutorId = EXECUTOR_ID_COUNTER .incrementAndGet()
126
126
val executorConf = KubernetesConf .createExecutorConf(
@@ -136,14 +136,14 @@ private[spark] class ExecutorPodsAllocator(
136
136
.build()
137
137
kubernetesClient.pods().create(podWithAttachedContainer)
138
138
newlyCreatedExecutors(newExecutorId) = clock.getTimeMillis()
139
- logDebug (s " Requested executor with id $newExecutorId from Kubernetes. " )
139
+ safeLogDebug (s " Requested executor with id $newExecutorId from Kubernetes. " )
140
140
}
141
141
} else if (currentRunningExecutors >= currentTotalExpectedExecutors) {
142
142
// TODO handle edge cases if we end up with more running executors than expected.
143
- logDebug (" Current number of running executors is equal to the number of requested" +
143
+ safeLogDebug (" Current number of running executors is equal to the number of requested" +
144
144
" executors. Not scaling up further." )
145
145
} else if (newlyCreatedExecutors.nonEmpty || currentPendingExecutors != 0 ) {
146
- logDebug (s " Still waiting for ${newlyCreatedExecutors.size + currentPendingExecutors}" +
146
+ safeLogDebug (s " Still waiting for ${newlyCreatedExecutors.size + currentPendingExecutors}" +
147
147
s " executors to begin running before requesting for more executors. # of executors in " +
148
148
s " pending status in the cluster: $currentPendingExecutors. # of executors that we have " +
149
149
s " created but we have not observed as being present in the cluster yet: " +
0 commit comments