dongjoon-hyun commented on code in PR #55639:
URL: https://github.com/apache/spark/pull/55639#discussion_r3171483901


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorResizePlugin.scala:
##########
@@ -67,40 +65,33 @@ class ExecutorResizeDriverPlugin extends DriverPlugin with 
Logging {
     val factor = sc.conf.getDouble(EXECUTOR_RESIZE_FACTOR.key, 0.1)
     val namespace = sc.conf.get(KUBERNETES_NAMESPACE)
 
+    // Scheduler is not created yet at init time; resolve it lazily in the 
periodic task.
     sparkContext = sc
 
-    try {
-      kubernetesClient = SparkKubernetesClientFactory.createKubernetesClient(
-        sc.conf.get(KUBERNETES_DRIVER_MASTER_URL),
-        Option(namespace),
-        KUBERNETES_AUTH_DRIVER_MOUNTED_CONF_PREFIX,
-        SparkKubernetesClientFactory.ClientType.Driver,
-        sc.conf,
-        None)
-
-      periodicService.scheduleAtFixedRate(() => {
-        try {
-          checkAndIncreaseMemory(namespace, threshold, factor)
-        } catch {
-          case e: Throwable => logError("Error in memory check thread", e)
+    periodicService.scheduleAtFixedRate(() => {

Review Comment:
   I addressed like the following.
   
   ```scala
   - periodicService.scheduleAtFixedRate(() => {
   + periodicService.scheduleAtFixedRate(() => if (!sparkContext.isStopped) {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to