dongjoon-hyun commented on code in PR #53840:
URL: https://github.com/apache/spark/pull/53840#discussion_r2828763379
##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterManager.scala:
##########
@@ -184,13 +188,30 @@ private[spark] class KubernetesClusterManager extends
ExternalClusterManager wit
classOf[SparkConf], classOf[org.apache.spark.SecurityManager],
classOf[KubernetesExecutorBuilder], classOf[KubernetesClient],
classOf[ExecutorPodsSnapshotsStore], classOf[Clock])
- cstr.newInstance(
+ val allocatorInstance = cstr.newInstance(
sc.conf,
sc.env.securityManager,
new KubernetesExecutorBuilder(),
kubernetesClient,
snapshotsStore,
new SystemClock())
+
+ // Try to set the lifecycle manager using reflection for backward
compatibility
+ // with custom allocators that may not have this method
+ lifecycleManager.foreach { manager =>
+ try {
+ val setLifecycleManagerMethod = cls.getMethod(
+ "setExecutorPodsLifecycleManager",
+ classOf[ExecutorPodsLifecycleManager])
+ setLifecycleManagerMethod.invoke(allocatorInstance, manager)
+ } catch {
+ case _: NoSuchMethodException =>
+ logInfo("Allocator does not support setExecutorPodsLifecycleManager
method. " +
+ "Pod creation failures will not be tracked.")
Review Comment:
For K8s `Deployment` and `StatefulSet`, the following will be correct. Could
you revise the message?
```scala
- logInfo("Allocator does not support setExecutorPodsLifecycleManager
method. " +
- "Pod creation failures will not be tracked.")
+ logInfo("No need to track pod creation failure because allocator does not
require it.")
```
--
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]