dongjoon-hyun commented on a change in pull request #35345:
URL: https://github.com/apache/spark/pull/35345#discussion_r797344239
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesDriverBuilder.scala
##########
@@ -38,8 +40,27 @@ private[spark] class KubernetesDriverBuilder {
.getOrElse(SparkPod.initialPod())
val userFeatures = conf.get(Config.KUBERNETES_DRIVER_POD_FEATURE_STEPS)
- .map { className =>
-
Utils.classForName(className).newInstance().asInstanceOf[KubernetesFeatureConfigStep]
+ .map { className => {
+ val feature = Utils.classForName[Any](className).newInstance()
+ val initializedFeature = feature match {
+ // Since 3.3, allow user implements feature with KubernetesDriverConf
+ case d: KubernetesDriverCustomFeatureConfigStep =>
+ d.init(conf)
+ Some(d)
+ // raise SparkException with wrong type feature step
+ case _: KubernetesExecutorCustomFeatureConfigStep =>
+ None
+ // Since 3.2, allow user implements feature without config
+ case f: KubernetesFeatureConfigStep =>
+ Some(f)
+ case _ => None
+ }
+ initializedFeature.getOrElse {
+ logError(s"Failed to initialize feature step: $className, " +
+ s"please make sure your driver side feature steps are implemented
by " +
+ s"`KubernetesDriverCustomFeatureConfigStep` or
`KubernetesCustomFeatureConfigStep`.")
Review comment:
Please don't use hard-coded class names. It's easily forgotten when we
rename the classes.
- `KubernetesDriverCustomFeatureConfigStep` ->
`classOf[KubernetesDriverCustomFeatureConfigStep].getName`
- `KubernetesCustomFeatureConfigStep` ->
`classOf[KubernetesCustomFeatureConfigStep].getName`
--
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]