holdenk commented on a change in pull request #28423:
URL: https://github.com/apache/spark/pull/28423#discussion_r418211835
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala
##########
@@ -127,25 +129,33 @@ private[spark] class Client(
.endSpec()
.build()
val driverPodName = resolvedDriverPod.getMetadata.getName
- Utils.tryWithResource(
- kubernetesClient
- .pods()
- .withName(driverPodName)
- .watch(watcher)) { _ =>
- val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
- try {
- val otherKubernetesResources =
- resolvedDriverSpec.driverKubernetesResources ++ Seq(configMap)
- addDriverOwnerReference(createdDriverPod, otherKubernetesResources)
- kubernetesClient.resourceList(otherKubernetesResources:
_*).createOrReplace()
- } catch {
- case NonFatal(e) =>
- kubernetesClient.pods().delete(createdDriverPod)
- throw e
- }
- val sId = Seq(conf.namespace, driverPodName).mkString(":")
- watcher.watchOrStop(sId)
+ var watch: Watch = null
+ val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
+ try {
+ val otherKubernetesResources =
resolvedDriverSpec.driverKubernetesResources ++ Seq(configMap)
+ addDriverOwnerReference(createdDriverPod, otherKubernetesResources)
+ kubernetesClient.resourceList(otherKubernetesResources:
_*).createOrReplace()
+ } catch {
+ case NonFatal(e) =>
+ kubernetesClient.pods().delete(createdDriverPod)
+ throw e
+ }
+ val sId = Seq(conf.namespace, driverPodName).mkString(":")
+ breakable {
+ while (true) {
+ try {
+ watch = kubernetesClient
+ .pods()
+ .withName(driverPodName)
+ .watch(watcher)
+ watcher.watchOrStop(sId)
Review comment:
If so, could we fix it by constructing the watcher then checking the pod
status manually with the K8s client then calling watchOrStop?
----------------------------------------------------------------
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]