tnachen commented on a change in pull request #25614: [WIP][SPARK-28887][K8S] Executor pod status fix URL: https://github.com/apache/spark/pull/25614#discussion_r319357937
########## File path: resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsSnapshot.scala ########## @@ -42,32 +43,47 @@ object ExecutorPodsSnapshot extends Logging { ExecutorPodsSnapshot(toStatesByExecutorId(executorPods)) } - def apply(): ExecutorPodsSnapshot = ExecutorPodsSnapshot(Map.empty[Long, ExecutorPodState]) + def apply(): ExecutorPodsSnapshot = ExecutorPodsSnapshot(Map.empty[Long, ExecutorState]) - private def toStatesByExecutorId(executorPods: Seq[Pod]): Map[Long, ExecutorPodState] = { + private def toStatesByExecutorId(executorPods: Seq[Pod]): Map[Long, ExecutorState] = { executorPods.map { pod => (pod.getMetadata.getLabels.get(SPARK_EXECUTOR_ID_LABEL).toLong, toState(pod)) }.toMap } - private def toState(pod: Pod): ExecutorPodState = { + private def toState(pod: Pod): ExecutorState = { if (isDeleted(pod)) { - PodDeleted(pod) + ExecutorPodDeleted(pod) } else { val phase = pod.getStatus.getPhase.toLowerCase(Locale.ROOT) phase match { case "pending" => - PodPending(pod) + ExecutorPending(pod) case "running" => - PodRunning(pod) + // Checking executor container status is not terminated Review comment: Can we add a test for this? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org