aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorShivansh <shiv4nsh@gmail.com>2016-09-04 12:39:26 +0100
committerSean Owen <sowen@cloudera.com>2016-09-04 12:39:26 +0100
commite75c162e9e510d74b07f28ccf6c7948ac317a7c6 (patch)
tree3d424bc7733e9d7ccca8e929e914ceeced4c8e19 /core/src
parent6b156e2fcf9c0c1ed0770a7ad9c54fa374760e17 (diff)
downloadspark-e75c162e9e510d74b07f28ccf6c7948ac317a7c6.tar.gz
spark-e75c162e9e510d74b07f28ccf6c7948ac317a7c6.tar.bz2
spark-e75c162e9e510d74b07f28ccf6c7948ac317a7c6.zip
[SPARK-17308] Improved the spark core code by replacing all pattern match on boolean value by if/else block.
## What changes were proposed in this pull request? Improved the code quality of spark by replacing all pattern match on boolean value by if/else block. ## How was this patch tested? By running the tests Author: Shivansh <shiv4nsh@gmail.com> Closes #14873 from shiv4nsh/SPARK-17308.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/Client.scala41
1 files changed, 20 insertions, 21 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/Client.scala b/core/src/main/scala/org/apache/spark/deploy/Client.scala
index bf2dab6e71..ee276e1b71 100644
--- a/core/src/main/scala/org/apache/spark/deploy/Client.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/Client.scala
@@ -124,27 +124,26 @@ private class ClientEndpoint(
logInfo("... polling master for driver state")
val statusResponse =
activeMasterEndpoint.askWithRetry[DriverStatusResponse](RequestDriverStatus(driverId))
- statusResponse.found match {
- case false =>
- logError(s"ERROR: Cluster master did not recognize $driverId")
- System.exit(-1)
- case true =>
- logInfo(s"State of $driverId is ${statusResponse.state.get}")
- // Worker node, if present
- (statusResponse.workerId, statusResponse.workerHostPort, statusResponse.state) match {
- case (Some(id), Some(hostPort), Some(DriverState.RUNNING)) =>
- logInfo(s"Driver running on $hostPort ($id)")
- case _ =>
- }
- // Exception, if present
- statusResponse.exception match {
- case Some(e) =>
- logError(s"Exception from cluster was: $e")
- e.printStackTrace()
- System.exit(-1)
- case _ =>
- System.exit(0)
- }
+ if (statusResponse.found) {
+ logInfo(s"State of $driverId is ${statusResponse.state.get}")
+ // Worker node, if present
+ (statusResponse.workerId, statusResponse.workerHostPort, statusResponse.state) match {
+ case (Some(id), Some(hostPort), Some(DriverState.RUNNING)) =>
+ logInfo(s"Driver running on $hostPort ($id)")
+ case _ =>
+ }
+ // Exception, if present
+ statusResponse.exception match {
+ case Some(e) =>
+ logError(s"Exception from cluster was: $e")
+ e.printStackTrace()
+ System.exit(-1)
+ case _ =>
+ System.exit(0)
+ }
+ } else {
+ logError(s"ERROR: Cluster master did not recognize $driverId")
+ System.exit(-1)
}
}