Skip to content

Commit

Permalink
upper case enums
Browse files Browse the repository at this point in the history
  • Loading branch information
squito committed Apr 27, 2015
1 parent 39ac29c commit ba3d9d2
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 1,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 1,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 3,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand All @@ -21,7 +21,7 @@
"schedulingPool" : "default",
"accumulatorUpdates" : [ ]
}, {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 1,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand All @@ -43,7 +43,7 @@
"schedulingPool" : "default",
"accumulatorUpdates" : [ ]
}, {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 0,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand All @@ -65,7 +65,7 @@
"schedulingPool" : "default",
"accumulatorUpdates" : [ ]
}, {
"status" : "Failed",
"status" : "FAILED",
"stageId" : 2,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 3,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand All @@ -21,7 +21,7 @@
"schedulingPool" : "default",
"accumulatorUpdates" : [ ]
}, {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 1,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand All @@ -43,7 +43,7 @@
"schedulingPool" : "default",
"accumulatorUpdates" : [ ]
}, {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 0,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ {
"status" : "Failed",
"status" : "FAILED",
"stageId" : 2,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 0,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[ {
"status" : "Complete",
"status" : "COMPLETE",
"stageId" : 0,
"attemptId" : 0,
"numActiveTasks" : 0,
Expand Down
6 changes: 3 additions & 3 deletions core/src/test/scala/org/apache/spark/ui/UISeleniumSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -255,15 +255,15 @@ 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())
}

for {
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())
}
Expand Down

0 comments on commit ba3d9d2

Please sign in to comment.