Skip to content

Commit 172dc56

Browse files
committed
Switched to js solution and updated docs
1 parent 6163f13 commit 172dc56

6 files changed

Lines changed: 25 additions & 10 deletions

File tree

core/src/main/resources/org/apache/spark/ui/static/historypage.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
* limitations under the License.
1616
*/
1717

18+
var appLimit = -1;
19+
20+
function setAppLimit(val) {
21+
appLimit = val;
22+
}
23+
1824
function makeIdNumeric(id) {
1925
var strs = id.split("_");
2026
if (strs.length < 3) {
@@ -89,7 +95,7 @@ $(document).ready(function() {
8995
requestedIncomplete = getParameterByName("showIncomplete", searchString);
9096
requestedIncomplete = (requestedIncomplete == "true" ? true : false);
9197

92-
$.getJSON("api/v1/applications", function(response,status,jqXHR) {
98+
$.getJSON("api/v1/applications?limit=" + appLimit, function(response,status,jqXHR) {
9399
var array = [];
94100
var hasMultipleAttempts = false;
95101
for (i in response) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
4545
<script src={UIUtils.prependBaseUri("/static/dataTables.rowsGroup.js")}></script> ++
4646
<div id="history-summary" class="span12 pagination"></div> ++
4747
<script src={UIUtils.prependBaseUri("/static/utils.js")}></script> ++
48-
<script src={UIUtils.prependBaseUri("/static/historypage.js")}></script>
48+
<script src={UIUtils.prependBaseUri("/static/historypage.js")}></script> ++
49+
<script>setAppLimit({parent.maxApplications})</script>
4950
} else if (requestedIncomplete) {
5051
<h4>No incomplete applications found!</h4>
5152
} else {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ class HistoryServer(
5656
// How many applications to retain
5757
private val retainedApplications = conf.getInt("spark.history.retainedApplications", 50)
5858

59-
// How many applications are available
60-
private val maxApplications = conf.get(HISTORY_MAX_APPS);
59+
// How many applications the summary ui displays
60+
private[history] val maxApplications = conf.get(HISTORY_UI_MAX_APPS);
6161

6262
// application
6363
private val appCache = new ApplicationCache(this, retainedApplications, new SystemClock())
@@ -175,7 +175,7 @@ class HistoryServer(
175175
* @return List of all known applications.
176176
*/
177177
def getApplicationList(): Iterable[ApplicationHistoryInfo] = {
178-
provider.getListing().take(maxApplications)
178+
provider.getListing()
179179
}
180180

181181
def getApplicationInfoList: Iterator[ApplicationInfo] = {

core/src/main/scala/org/apache/spark/internal/config/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ package object config {
120120
.intConf
121121
.createWithDefault(100000)
122122

123-
// To limit how many applications are available in the History Server
124-
private[spark] val HISTORY_MAX_APPS =
125-
ConfigBuilder("spark.history.maxApplications").intConf.createWithDefault(Integer.MAX_VALUE)
123+
// To limit how many applications are shown in the History Server summary ui
124+
private[spark] val HISTORY_UI_MAX_APPS =
125+
ConfigBuilder("spark.history.ui.maxApplications").intConf.createWithDefault(Integer.MAX_VALUE)
126126
}

dev/.rat-excludes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,3 @@ org.apache.spark.scheduler.ExternalClusterManager
101101
.*\.sql
102102
.Rbuildignore
103103
org.apache.spark.deploy.yarn.security.ServiceCredentialProvider
104-
spark-warehouse

docs/monitoring.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ The history server can be configured as follows:
118118
applications will be removed.
119119
</td>
120120
</tr>
121+
<tr>
122+
<td>spark.history.ui.maxApplications</td>
123+
<td>Int.MaxValue</td>
124+
<td>
125+
The number of applications to display on the history summary page. Application UIs are
126+
still available even if they are not displayed on the history summary page.
127+
</td>
128+
</tr>
121129
<tr>
122130
<td>spark.history.ui.port</td>
123131
<td>18080</td>
@@ -242,7 +250,8 @@ can be identified by their `[attempt-id]`. In the API listed below, when running
242250
<br>Examples:
243251
<br><code>?minDate=2015-02-10</code>
244252
<br><code>?minDate=2015-02-03T16:42:40.000GMT</code>
245-
<br><code>?maxDate=[date]</code> latest date/time to list; uses same format as <code>minDate</code>.</td>
253+
<br><code>?maxDate=[date]</code> latest date/time to list; uses same format as <code>minDate</code>.
254+
<br><code>?limit=[limit]</code> limits the number of applications listed.</td>
246255
</tr>
247256
<tr>
248257
<td><code>/applications/[app-id]/jobs</code></td>

0 commit comments

Comments
 (0)