dongjoon-hyun commented on a change in pull request #30892:
URL: https://github.com/apache/spark/pull/30892#discussion_r550988293



##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsSnapshot.scala
##########
@@ -65,14 +72,33 @@ object ExecutorPodsSnapshot extends Logging {
         case "pending" =>
           PodPending(pod)
         case "running" =>
+          // If we're checking all containers look for any non-zero exits
           if (shouldCheckAllContainers &&
             "Never" == pod.getSpec.getRestartPolicy &&
             pod.getStatus.getContainerStatuses.stream
               .map[ContainerStateTerminated](cs => cs.getState.getTerminated)
               .anyMatch(t => t != null && t.getExitCode != 0)) {
             PodFailed(pod)
           } else {
-            PodRunning(pod)
+            // Otherwise look for the Spark container
+            val sparkContainerStatusOpt = 
pod.getStatus.getContainerStatuses.asScala
+              .find(_.getName() == sparkContainerName)

Review comment:
       Sorry, but this seems to fail like the following. Could you check this 
once more, @holdenk ?
   ```
   containerStatuses=[
   ContainerStatus(
     containerID=docker://...,
     image=...,
     imageID=..., 
     lastState=ContainerState(running=null, terminated=null, waiting=null, 
additionalProperties={}),
     name=pod,
     ready=true,
     restartCount=0,
     started=true,
     
state=ContainerState(running=ContainerStateRunning(startedAt=2021-01-03T10:25:24Z,
 additionalProperties={}), terminated=null, waiting=null, 
additionalProperties={}),
     additionalProperties={}
   )
   ]
   ```

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsSnapshot.scala
##########
@@ -65,14 +72,33 @@ object ExecutorPodsSnapshot extends Logging {
         case "pending" =>
           PodPending(pod)
         case "running" =>
+          // If we're checking all containers look for any non-zero exits
           if (shouldCheckAllContainers &&
             "Never" == pod.getSpec.getRestartPolicy &&
             pod.getStatus.getContainerStatuses.stream
               .map[ContainerStateTerminated](cs => cs.getState.getTerminated)
               .anyMatch(t => t != null && t.getExitCode != 0)) {
             PodFailed(pod)
           } else {
-            PodRunning(pod)
+            // Otherwise look for the Spark container
+            val sparkContainerStatusOpt = 
pod.getStatus.getContainerStatuses.asScala
+              .find(_.getName() == sparkContainerName)

Review comment:
       Sorry, but this seems to fail like the following in some cases. Could 
you check this once more, @holdenk ?
   ```
   containerStatuses=[
   ContainerStatus(
     containerID=docker://...,
     image=...,
     imageID=..., 
     lastState=ContainerState(running=null, terminated=null, waiting=null, 
additionalProperties={}),
     name=pod,
     ready=true,
     restartCount=0,
     started=true,
     
state=ContainerState(running=ContainerStateRunning(startedAt=2021-01-03T10:25:24Z,
 additionalProperties={}), terminated=null, waiting=null, 
additionalProperties={}),
     additionalProperties={}
   )
   ]
   ```




----------------------------------------------------------------
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:
[email protected]



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

Reply via email to