From ba3d9d29dc309ae71ed7ef6ba31cb1f324dc5c36 Mon Sep 17 00:00:00 2001 From: Imran Rashid Date: Mon, 27 Apr 2015 14:59:27 -0500 Subject: [PATCH] upper case enums --- .../java/org/apache/spark/status/api/v1/StageStatus.java | 8 ++++---- .../apache/spark/status/api/v1/AllStagesResource.scala | 8 ++++---- .../org/apache/spark/status/api/v1/OneStageResource.scala | 8 ++++---- .../local-1422981780767/stages/1/0/json_expectation | 2 +- .../local-1422981780767/stages/1/json_expectation | 2 +- .../local-1422981780767/stages/json_expectation | 8 ++++---- .../stages?status=complete/json_expectation | 6 +++--- .../stages?status=failed/json_expectation | 2 +- .../local-1426533911241/stages/0/0/json_expectation | 2 +- .../local-1426533911241/stages/json_expectation | 2 +- .../test/scala/org/apache/spark/ui/UISeleniumSuite.scala | 6 +++--- 11 files changed, 27 insertions(+), 27 deletions(-) diff --git a/core/src/main/java/org/apache/spark/status/api/v1/StageStatus.java b/core/src/main/java/org/apache/spark/status/api/v1/StageStatus.java index 297ccb4c9e4cd..9dbb565aab707 100644 --- a/core/src/main/java/org/apache/spark/status/api/v1/StageStatus.java +++ b/core/src/main/java/org/apache/spark/status/api/v1/StageStatus.java @@ -20,10 +20,10 @@ import org.apache.spark.util.EnumUtil; public enum StageStatus { - Active, - Complete, - Failed, - Pending; + ACTIVE, + COMPLETE, + FAILED, + PENDING; public static StageStatus fromString(String str) { return EnumUtil.parseIgnoreCase(StageStatus.class, str); diff --git a/core/src/main/scala/org/apache/spark/status/api/v1/AllStagesResource.scala b/core/src/main/scala/org/apache/spark/status/api/v1/AllStagesResource.scala index b866e1e7c545b..f48e45a68794f 100644 --- a/core/src/main/scala/org/apache/spark/status/api/v1/AllStagesResource.scala +++ b/core/src/main/scala/org/apache/spark/status/api/v1/AllStagesResource.scala @@ -122,10 +122,10 @@ private[v1] object AllStagesResource { val listener = ui.jobProgressListener listener.synchronized { Seq( - StageStatus.Active -> listener.activeStages.values.toSeq, - StageStatus.Complete -> listener.completedStages.reverse.toSeq, - StageStatus.Failed -> listener.failedStages.reverse.toSeq, - StageStatus.Pending -> listener.pendingStages.values.toSeq + StageStatus.ACTIVE -> listener.activeStages.values.toSeq, + StageStatus.COMPLETE -> listener.completedStages.reverse.toSeq, + StageStatus.FAILED -> listener.failedStages.reverse.toSeq, + StageStatus.PENDING -> listener.pendingStages.values.toSeq ) } } diff --git a/core/src/main/scala/org/apache/spark/status/api/v1/OneStageResource.scala b/core/src/main/scala/org/apache/spark/status/api/v1/OneStageResource.scala index 9fb28aa6a4d39..79011b3983214 100644 --- a/core/src/main/scala/org/apache/spark/status/api/v1/OneStageResource.scala +++ b/core/src/main/scala/org/apache/spark/status/api/v1/OneStageResource.scala @@ -122,10 +122,10 @@ private[v1] class OneStageResource(uiRoot: UIRoot) { StageStatusInfoUi(status, info, ui) } } - getStatusInfoUi(Active, listener.activeStages.values.toSeq) ++ - getStatusInfoUi(Complete, listener.completedStages) ++ - getStatusInfoUi(Failed, listener.failedStages) ++ - getStatusInfoUi(Pending, listener.pendingStages.values.toSeq) + getStatusInfoUi(ACTIVE, listener.activeStages.values.toSeq) ++ + getStatusInfoUi(COMPLETE, listener.completedStages) ++ + getStatusInfoUi(FAILED, listener.failedStages) ++ + getStatusInfoUi(PENDING, listener.pendingStages.values.toSeq) } } diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/0/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/0/json_expectation index aaed0d8ab3652..111cb8163eb3d 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/0/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/0/json_expectation @@ -1,5 +1,5 @@ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 1, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/json_expectation index 88fd92051bf5c..ef339f89afa45 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/1/json_expectation @@ -1,5 +1,5 @@ [ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 1, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/json_expectation index c083a00209cb6..056fac7088594 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages/json_expectation @@ -1,5 +1,5 @@ [ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 3, "attemptId" : 0, "numActiveTasks" : 0, @@ -21,7 +21,7 @@ "schedulingPool" : "default", "accumulatorUpdates" : [ ] }, { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 1, "attemptId" : 0, "numActiveTasks" : 0, @@ -43,7 +43,7 @@ "schedulingPool" : "default", "accumulatorUpdates" : [ ] }, { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 0, "attemptId" : 0, "numActiveTasks" : 0, @@ -65,7 +65,7 @@ "schedulingPool" : "default", "accumulatorUpdates" : [ ] }, { - "status" : "Failed", + "status" : "FAILED", "stageId" : 2, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=complete/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=complete/json_expectation index 6ef1daff8be02..31ac9beea8788 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=complete/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=complete/json_expectation @@ -1,5 +1,5 @@ [ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 3, "attemptId" : 0, "numActiveTasks" : 0, @@ -21,7 +21,7 @@ "schedulingPool" : "default", "accumulatorUpdates" : [ ] }, { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 1, "attemptId" : 0, "numActiveTasks" : 0, @@ -43,7 +43,7 @@ "schedulingPool" : "default", "accumulatorUpdates" : [ ] }, { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 0, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=failed/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=failed/json_expectation index 3085482839133..bff6a4f69d077 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=failed/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1422981780767/stages?status=failed/json_expectation @@ -1,5 +1,5 @@ [ { - "status" : "Failed", + "status" : "FAILED", "stageId" : 2, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/0/0/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/0/0/json_expectation index 63ea3ecb15f11..32d5731676ad5 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/0/0/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/0/0/json_expectation @@ -1,5 +1,5 @@ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 0, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/json_expectation b/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/json_expectation index 7ac2045898fb2..79ccacd309693 100644 --- a/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/json_expectation +++ b/core/src/test/resources/HistoryServerExpectations/applications/local-1426533911241/stages/json_expectation @@ -1,5 +1,5 @@ [ { - "status" : "Complete", + "status" : "COMPLETE", "stageId" : 0, "attemptId" : 0, "numActiveTasks" : 0, diff --git a/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala b/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala index 7efa4cc289bd3..b84c467fc606c 100644 --- a/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala +++ b/core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala @@ -133,7 +133,7 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before } val stageJson = getJson(sc.ui.get, "stages") stageJson.children.length should be (1) - (stageJson \ "status").extract[String] should be (StageStatus.Failed.name()) + (stageJson \ "status").extract[String] should be (StageStatus.FAILED.name()) // Regression test for SPARK-2105 class NotSerializable @@ -255,7 +255,7 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before JInt(stageId) <- stage \ "stageId" JInt(attemptId) <- stage \ "attemptId" } { - val exp = if (attemptId == 0 && stageId == 1) StageStatus.Failed else StageStatus.Complete + val exp = if (attemptId == 0 && stageId == 1) StageStatus.FAILED else StageStatus.COMPLETE status should be (exp.name()) } @@ -263,7 +263,7 @@ class UISeleniumSuite extends FunSuite with WebBrowser with Matchers with Before stageId <- 0 to 1 attemptId <- 0 to 1 } { - val exp = if (attemptId == 0 && stageId == 1) StageStatus.Failed else StageStatus.Complete + val exp = if (attemptId == 0 && stageId == 1) StageStatus.FAILED else StageStatus.COMPLETE val stageJson = getJson(sc.ui.get, s"stages/$stageId/$attemptId") (stageJson \ "status").extract[String] should be (exp.name()) }