jkleckner commented on a change in pull request #30283:
URL: https://github.com/apache/spark/pull/30283#discussion_r520244849



##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -28,8 +29,10 @@ import org.apache.spark.SparkException
 import org.apache.spark.internal.Logging
 import org.apache.spark.util.ThreadUtils
 
+
 private[k8s] trait LoggingPodStatusWatcher extends Watcher[Pod] {
-  def awaitCompletion(): Unit
+  def reset(): Unit
+  def watchOrStop(sId: String): Boolean

Review comment:
       Done.

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -42,9 +45,12 @@ private[k8s] trait LoggingPodStatusWatcher extends 
Watcher[Pod] {
  */
 private[k8s] class LoggingPodStatusWatcherImpl(
     appId: String,
-    maybeLoggingInterval: Option[Long])
+    maybeLoggingInterval: Option[Long],
+    waitForCompletion: Boolean)
   extends LoggingPodStatusWatcher with Logging {
 
+  private var resourceTooOldReceived: Boolean = false
+  private var podCompleted = false

Review comment:
       Done.

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -77,9 +83,19 @@ private[k8s] class LoggingPodStatusWatcherImpl(
     }
   }
 
+  override def reset(): Unit = {
+    resourceTooOldReceived = false
+  }
+
   override def onClose(e: KubernetesClientException): Unit = {
-    logDebug(s"Stopping watching application $appId with last-observed phase 
$phase")
-    closeWatch()
+    logInfo(s"Stopping watching application $appId with last-observed phase 
$phase")

Review comment:
       Done

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -77,9 +83,19 @@ private[k8s] class LoggingPodStatusWatcherImpl(
     }
   }
 
+  override def reset(): Unit = {
+    resourceTooOldReceived = false
+  }
+
   override def onClose(e: KubernetesClientException): Unit = {
-    logDebug(s"Stopping watching application $appId with last-observed phase 
$phase")
-    closeWatch()
+    logInfo(s"Stopping watching application $appId with last-observed phase 
$phase")
+    if (e != null && e.getCode==HTTP_GONE) {
+      resourceTooOldReceived = true
+      logInfo(s"Got HTTP Gone code, resource version changed in k8s api: $e")
+    } else {
+      logInfo(s"Got proper termination code, closing watcher.")

Review comment:
       Done.

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -77,9 +83,19 @@ private[k8s] class LoggingPodStatusWatcherImpl(
     }
   }
 
+  override def reset(): Unit = {
+    resourceTooOldReceived = false
+  }
+
   override def onClose(e: KubernetesClientException): Unit = {
-    logDebug(s"Stopping watching application $appId with last-observed phase 
$phase")
-    closeWatch()
+    logInfo(s"Stopping watching application $appId with last-observed phase 
$phase")
+    if (e != null && e.getCode==HTTP_GONE) {
+      resourceTooOldReceived = true
+      logInfo(s"Got HTTP Gone code, resource version changed in k8s api: $e")

Review comment:
       Done.

##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala
##########
@@ -134,13 +151,6 @@ private[k8s] class LoggingPodStatusWatcherImpl(
     }.mkString("")
   }
 
-  override def awaitCompletion(): Unit = {
-    podCompletedFuture.await()
-    logInfo(pod.map { p =>
-      s"Container final statuses:\n\n${containersDescription(p)}"
-    }.getOrElse("No containers were found in the driver pod."))
-  }
-

Review comment:
       @dongjoon-hyun It does look like it originates from SPARK-28947 
02c5b4f76337cc3901b8741887292bb4478931f3 which eliminated the future and was a 
rename.
   
   Since this is a private trait, the logic should be completely self-contained 
and safe to remove.
   




----------------------------------------------------------------
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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to