Skip to content

Commit 1fc65b0

Browse files
committed
Revert "Revert "[SPARK-3454] separate json endpoints for data in the UI""
This reverts commit 51b3d41.
1 parent 32cdc81 commit 1fc65b0

File tree

100 files changed

+19946
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+19946
-172
lines changed

.rat-excludes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,12 @@ logs
7474
.*scalastyle-output.xml
7575
.*dependency-reduced-pom.xml
7676
known_translations
77+
json_expectation
78+
local-1422981759269/*
79+
local-1422981780767/*
80+
local-1425081759269/*
81+
local-1426533911241/*
82+
local-1426633911242/*
83+
local-1427397477963/*
7784
DESCRIPTION
7885
NAMESPACE

core/pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,14 @@
228228
<artifactId>json4s-jackson_${scala.binary.version}</artifactId>
229229
<version>3.2.10</version>
230230
</dependency>
231+
<dependency>
232+
<groupId>com.sun.jersey</groupId>
233+
<artifactId>jersey-server</artifactId>
234+
</dependency>
235+
<dependency>
236+
<groupId>com.sun.jersey</groupId>
237+
<artifactId>jersey-core</artifactId>
238+
</dependency>
231239
<dependency>
232240
<groupId>org.apache.mesos</groupId>
233241
<artifactId>mesos</artifactId>

core/src/main/java/org/apache/spark/JobExecutionStatus.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@
1717

1818
package org.apache.spark;
1919

20+
import org.apache.spark.util.EnumUtil;
21+
2022
public enum JobExecutionStatus {
2123
RUNNING,
2224
SUCCEEDED,
2325
FAILED,
24-
UNKNOWN
26+
UNKNOWN;
27+
28+
public static JobExecutionStatus fromString(String str) {
29+
return EnumUtil.parseIgnoreCase(JobExecutionStatus.class, str);
30+
}
2531
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.status.api.v1;
19+
20+
import org.apache.spark.util.EnumUtil;
21+
22+
public enum ApplicationStatus {
23+
COMPLETED,
24+
RUNNING;
25+
26+
public static ApplicationStatus fromString(String str) {
27+
return EnumUtil.parseIgnoreCase(ApplicationStatus.class, str);
28+
}
29+
30+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.status.api.v1;
19+
20+
import org.apache.spark.util.EnumUtil;
21+
22+
public enum StageStatus {
23+
ACTIVE,
24+
COMPLETE,
25+
FAILED,
26+
PENDING;
27+
28+
public static StageStatus fromString(String str) {
29+
return EnumUtil.parseIgnoreCase(StageStatus.class, str);
30+
}
31+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.status.api.v1;
19+
20+
import org.apache.spark.util.EnumUtil;
21+
22+
import java.util.HashSet;
23+
import java.util.Set;
24+
25+
public enum TaskSorting {
26+
ID,
27+
INCREASING_RUNTIME("runtime"),
28+
DECREASING_RUNTIME("-runtime");
29+
30+
private final Set<String> alternateNames;
31+
private TaskSorting(String... names) {
32+
alternateNames = new HashSet<String>();
33+
for (String n: names) {
34+
alternateNames.add(n);
35+
}
36+
}
37+
38+
public static TaskSorting fromString(String str) {
39+
String lower = str.toLowerCase();
40+
for (TaskSorting t: values()) {
41+
if (t.alternateNames.contains(lower)) {
42+
return t;
43+
}
44+
}
45+
return EnumUtil.parseIgnoreCase(TaskSorting.class, str);
46+
}
47+
48+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
package org.apache.spark.util;
18+
19+
import com.google.common.base.Joiner;
20+
import org.apache.spark.annotation.Private;
21+
22+
@Private
23+
public class EnumUtil {
24+
public static <E extends Enum<E>> E parseIgnoreCase(Class<E> clz, String str) {
25+
E[] constants = clz.getEnumConstants();
26+
if (str == null) {
27+
return null;
28+
}
29+
for (E e : constants) {
30+
if (e.name().equalsIgnoreCase(str)) {
31+
return e;
32+
}
33+
}
34+
throw new IllegalArgumentException(
35+
String.format("Illegal type='%s'. Supported type values: %s",
36+
str, Joiner.on(", ").join(constants)));
37+
}
38+
}

core/src/main/scala/org/apache/spark/SparkContext.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class SparkContext(config: SparkConf) extends Logging with ExecutorAllocationCli
430430
_ui =
431431
if (conf.getBoolean("spark.ui.enabled", true)) {
432432
Some(SparkUI.createLiveUI(this, _conf, listenerBus, _jobProgressListener,
433-
_env.securityManager,appName))
433+
_env.securityManager,appName, startTime = startTime))
434434
} else {
435435
// For tests, do not enable the UI
436436
None
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.spark.annotation;
19+
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
24+
25+
/**
26+
* A class that is considered private to the internals of Spark -- there is a high-likelihood
27+
* they will be changed in future versions of Spark.
28+
*
29+
* This should be used only when the standard Scala / Java means of protecting classes are
30+
* insufficient. In particular, Java has no equivalent of private[spark], so we use this annotation
31+
* in its place.
32+
*
33+
* NOTE: If there exists a Scaladoc comment that immediately precedes this annotation, the first
34+
* line of the comment must be ":: Private ::" with no trailing blank line. This is because
35+
* of the known issue that Scaladoc displays only either the annotation or the comment, whichever
36+
* comes first.
37+
*/
38+
@Retention(RetentionPolicy.RUNTIME)
39+
@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER,
40+
ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE})
41+
public @interface Private {}

core/src/main/scala/org/apache/spark/deploy/history/ApplicationHistoryProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ package org.apache.spark.deploy.history
1919

2020
import org.apache.spark.ui.SparkUI
2121

22-
private[history] case class ApplicationAttemptInfo(
22+
private[spark] case class ApplicationAttemptInfo(
2323
attemptId: Option[String],
2424
startTime: Long,
2525
endTime: Long,
2626
lastUpdated: Long,
2727
sparkUser: String,
2828
completed: Boolean = false)
2929

30-
private[history] case class ApplicationHistoryInfo(
30+
private[spark] case class ApplicationHistoryInfo(
3131
id: String,
3232
name: String,
3333
attempts: List[ApplicationAttemptInfo])

0 commit comments

Comments
 (0)