holdenk commented on a change in pull request #33508:
URL: https://github.com/apache/spark/pull/33508#discussion_r679394820
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsSnapshot.scala
##########
@@ -61,7 +61,22 @@ object ExecutorPodsSnapshot extends Logging {
private def toStatesByExecutorId(executorPods: Seq[Pod]): Map[Long,
ExecutorPodState] = {
executorPods.map { pod =>
- (pod.getMetadata.getLabels.get(SPARK_EXECUTOR_ID_LABEL).toLong,
toState(pod))
+ pod.getMetadata.getLabels.get(SPARK_EXECUTOR_ID_LABEL) match {
+ case "EXECID" | null =>
+ // The pod has been created by something other than Spark and we
should process
+ // pod the name to get the ID instead of the label.
+ val execIdRE = ".+-([0-9]+)".r
+ val podName = pod.getMetadata.getName
+ podName match {
+ case execIdRE(id) =>
+ (id.toLong, toState(pod))
+ case _ =>
+ throw new Exception(s"Failed to parse podname ${podName}")
Review comment:
Sure
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsSnapshot.scala
##########
@@ -61,7 +61,22 @@ object ExecutorPodsSnapshot extends Logging {
private def toStatesByExecutorId(executorPods: Seq[Pod]): Map[Long,
ExecutorPodState] = {
executorPods.map { pod =>
- (pod.getMetadata.getLabels.get(SPARK_EXECUTOR_ID_LABEL).toLong,
toState(pod))
+ pod.getMetadata.getLabels.get(SPARK_EXECUTOR_ID_LABEL) match {
+ case "EXECID" | null =>
+ // The pod has been created by something other than Spark and we
should process
+ // pod the name to get the ID instead of the label.
+ val execIdRE = ".+-([0-9]+)".r
Review comment:
So if a pod is created without an exec label and the podname doesn't let
us infer the exec ID we'll just throw an exception since there is not a way I
could think of to recover gracefully.
--
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]