dongjoon-hyun commented on code in PR #40118:
URL: https://github.com/apache/spark/pull/40118#discussion_r1151378382
##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/LoggingPodStatusWatcher.scala:
##########
@@ -95,6 +100,27 @@ private[k8s] class LoggingPodStatusWatcherImpl(conf:
KubernetesDriverConf)
this.notifyAll()
}
+ override def getDriverExitCode(): Option[Int] = synchronized {
+ if (hasCompleted()) {
+ val driverContainerName =
conf.get(KUBERNETES_DRIVER_PODTEMPLATE_CONTAINER_NAME)
+ .getOrElse(DEFAULT_DRIVER_CONTAINER_NAME)
+ pod.foreach { p =>
+ try {
+ return Some(p.getStatus.getContainerStatuses.asScala
+ .filter(driverContainerName == _.getName)
+ .head.getState.getTerminated.getExitCode)
+ } catch {
+ case _: NullPointerException =>
+ logError("Fail to find completed driver container exit code")
+ return None
+ }
+ }
+ throw new SparkException("Fail to get driver exit code, when the
application completed")
+ } else {
+ throw new SparkException("Call getDriverExitCode() when the application
has not completed")
Review Comment:
It seems that this method is designed to return four cases, but why
`NullPointerException` is converted `None` instead of case (1)?
- Case 1: SparkException: In case of `hasCompleted==false`
- Case 2: Some(getExitCode): Successful case
- Case 3: None: In case of `hasCompleted==true`, but `NullPointerException`
- Case 4: SparkException: `Fail to get driver exit code, when the
application completed`????
--
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]