Skip to content

Commit f649e42

Browse files
author
pgandhi
committed
[SPARK-21809] : Made changes as per comments
Reverted the function getStandAloneAppId() to take in function as parameter, removing unused variable taskTableHtml in StagePage.scala and adding additional check for displaying accumulator column in task table
1 parent 0b2a8cf commit f649e42

File tree

4 files changed

+18
-27
lines changed

4 files changed

+18
-27
lines changed

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,7 @@ $(document).ready(function () {
126126

127127
executorsSummary = $("#active-executors");
128128

129-
var app_id = getStandAloneAppId();
130-
buildExecutorDataTables(app_id);
131-
132-
function buildExecutorDataTables(appId) {
129+
getStandAloneAppId(function (appId) {
133130

134131
var endPoint = createRESTEndPoint(appId);
135132
$.getJSON(endPoint, function (response, status, jqXHR) {
@@ -548,5 +545,5 @@ $(document).ready(function () {
548545

549546
});
550547
});
551-
}
548+
});
552549
});

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $.extend( $.fn.dataTable.ext.type.order, {
3636
}
3737
} );
3838

39-
// This function will only parse the URL under certain formate
39+
// This function will only parse the URL under certain format
4040
// e.g. https://axonitered-jt1.red.ygrid.yahoo.com:50509/history/application_1502220952225_59143/stages/stage/?id=0&attempt=0
4141
function stageEndPoint(appId) {
4242
var words = document.baseURI.split('/');
@@ -103,10 +103,7 @@ $(document).ready(function () {
103103
"</div>");
104104

105105
tasksSummary = $("#active-tasks");
106-
var app_id = getStandAloneAppId();
107-
buildStageDataTables(app_id);
108-
109-
function buildStageDataTables(appId) {
106+
getStandAloneAppId(function (appId) {
110107

111108
var endPoint = stageEndPoint(appId);
112109
$.getJSON(endPoint, function(response, status, jqXHR) {
@@ -386,7 +383,7 @@ $(document).ready(function () {
386383
},
387384
{
388385
data : function (row, type) {
389-
if (accumulator_table.length > 0) {
386+
if (accumulator_table.length > 0 && row.accumulatorUpdates.length > 0) {
390387
return row.accumulatorUpdates[0].name + ' : ' + row.accumulatorUpdates[0].update;
391388
} else {
392389
return 0;
@@ -467,5 +464,5 @@ $(document).ready(function () {
467464
}
468465
});
469466
});
470-
}
467+
});
471468
});

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,27 @@ function formatLogsCells(execLogs, type) {
5757
return result;
5858
}
5959

60-
function getStandAloneAppId() {
60+
function getStandAloneAppId(cb) {
6161
var words = document.baseURI.split('/');
6262
var ind = words.indexOf("proxy");
6363
if (ind > 0) {
6464
var appId = words[ind + 1];
65-
return appId;
65+
cb(appId);
66+
return;
6667
}
6768
ind = words.indexOf("history");
6869
if (ind > 0) {
6970
var appId = words[ind + 1];
70-
return appId;
71+
cb(appId);
72+
return;
7173
}
7274
//Looks like Web UI is running in standalone mode
7375
//Let's get application-id using REST End Point
7476
$.getJSON(location.origin + "/api/v1/applications", function(response, status, jqXHR) {
7577
if (response && response.length > 0) {
76-
var appId = response[0].id
77-
return appId;
78+
var appId = response[0].id;
79+
cb(appId);
80+
return;
7881
}
7982
});
8083
}

core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
206206
}
207207
}
208208
val currentTime = System.currentTimeMillis()
209-
val (taskTable, taskTableHTML) = try {
209+
val taskTable = try {
210210
val _taskTable = new TaskPagedTable(
211211
parent.conf,
212212
UIUtils.prependBaseUri(parent.basePath) +
@@ -225,17 +225,11 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
225225
desc = taskSortDesc,
226226
executorsListener = executorsListener
227227
)
228-
(_taskTable, _taskTable.table(page))
228+
_taskTable.table(page)
229+
_taskTable
229230
} catch {
230231
case e @ (_ : IllegalArgumentException | _ : IndexOutOfBoundsException) =>
231-
val errorMessage =
232-
<div class="alert alert-error">
233-
<p>Error while rendering stage table:</p>
234-
<pre>
235-
{Utils.exceptionString(e)}
236-
</pre>
237-
</div>
238-
(null, errorMessage)
232+
null
239233
}
240234

241235
val jsForScrollingDownToTaskTable =

0 commit comments

Comments
 (0)