MAPREDUCE-6405. NullPointerException in App Attempts page. Contributed by
Siqi Li and Gera Shegalov.
This commit is contained in:
parent
d112d18324
commit
311a4179cc
@ -483,6 +483,9 @@ Release 2.8.0 - UNRELEASED
|
|||||||
MAPREDUCE-6373. The logger reports total input paths but it is referring
|
MAPREDUCE-6373. The logger reports total input paths but it is referring
|
||||||
to input files. (Bibin A Chundatt via devaraj)
|
to input files. (Bibin A Chundatt via devaraj)
|
||||||
|
|
||||||
|
MAPREDUCE-6405. NullPointerException in App Attempts page.
|
||||||
|
(Siqi Li and Gera Shegalov via devaraj)
|
||||||
|
|
||||||
Release 2.7.1 - UNRELEASED
|
Release 2.7.1 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -24,11 +24,14 @@
|
|||||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
|
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID;
|
||||||
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
|
import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringEscapeUtils;
|
import org.apache.commons.lang.StringEscapeUtils;
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.mapreduce.MRConfig;
|
import org.apache.hadoop.mapreduce.MRConfig;
|
||||||
|
import org.apache.hadoop.mapreduce.v2.api.records.JobId;
|
||||||
|
import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptState;
|
||||||
import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt;
|
import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt;
|
||||||
import org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo;
|
import org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo;
|
||||||
import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil;
|
import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil;
|
||||||
@ -48,7 +51,6 @@ public class TaskPage extends AppView {
|
|||||||
static class AttemptsBlock extends HtmlBlock {
|
static class AttemptsBlock extends HtmlBlock {
|
||||||
final App app;
|
final App app;
|
||||||
final boolean enableUIActions;
|
final boolean enableUIActions;
|
||||||
private String stateURLFormat;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AttemptsBlock(App ctx, Configuration conf) {
|
AttemptsBlock(App ctx, Configuration conf) {
|
||||||
@ -66,37 +68,36 @@ protected void render(Block html) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JobId jobId = app.getJob().getID();
|
||||||
if (enableUIActions) {
|
if (enableUIActions) {
|
||||||
// Kill task attempt
|
// Kill task attempt
|
||||||
String appID = app.getJob().getID().getAppId().toString();
|
|
||||||
String jobID = app.getJob().getID().toString();
|
|
||||||
String taskID = app.getTask().getID().toString();
|
|
||||||
stateURLFormat =
|
|
||||||
String.format("/proxy/%s/ws/v1/mapreduce/jobs/%s/tasks/%s/"
|
|
||||||
+ "attempts", appID, jobID, taskID) + "/%s/state";
|
|
||||||
|
|
||||||
String current =
|
|
||||||
String.format("/proxy/%s/mapreduce/task/%s", appID, taskID);
|
|
||||||
|
|
||||||
StringBuilder script = new StringBuilder();
|
StringBuilder script = new StringBuilder();
|
||||||
script.append("function confirmAction(stateURL) {")
|
script
|
||||||
.append(" b = confirm(\"Are you sure?\");")
|
.append("function confirmAction(appID, jobID, taskID, attID) {\n")
|
||||||
.append(" if (b == true) {")
|
.append(" var b = confirm(\"Are you sure?\");\n")
|
||||||
.append(" $.ajax({")
|
.append(" if (b == true) {\n")
|
||||||
.append(" type: 'PUT',")
|
.append(" var current = '/proxy/' + appID")
|
||||||
.append(" url: stateURL,")
|
.append(" + '/mapreduce/task/' + taskID;\n")
|
||||||
.append(" contentType: 'application/json',")
|
.append(" var stateURL = '/proxy/' + appID")
|
||||||
.append(" data: '{\"state\":\"KILLED\"}',")
|
.append(" + '/ws/v1/mapreduce/jobs/' + jobID")
|
||||||
.append(" dataType: 'json'")
|
.append(" + '/tasks/' + taskID")
|
||||||
.append(" }).done(function(data){")
|
.append(" + '/attempts/' + attID + '/state';\n")
|
||||||
.append(" setTimeout(function(){")
|
.append(" $.ajax({\n")
|
||||||
.append(" location.href = '").append(current).append("';")
|
.append(" type: 'PUT',\n")
|
||||||
.append(" }, 1000);")
|
.append(" url: stateURL,\n")
|
||||||
.append(" }).fail(function(data){")
|
.append(" contentType: 'application/json',\n")
|
||||||
.append(" console.log(data);")
|
.append(" data: '{\"state\":\"KILLED\"}',\n")
|
||||||
.append(" });")
|
.append(" dataType: 'json'\n")
|
||||||
.append(" }")
|
.append(" }).done(function(data) {\n")
|
||||||
.append("}");
|
.append(" setTimeout(function() {\n")
|
||||||
|
.append(" location.href = current;\n")
|
||||||
|
.append(" }, 1000);\n")
|
||||||
|
.append(" }).fail(function(data) {\n")
|
||||||
|
.append(" console.log(data);\n")
|
||||||
|
.append(" });\n")
|
||||||
|
.append(" }\n")
|
||||||
|
.append("}\n");
|
||||||
|
|
||||||
html.script().$type("text/javascript")._(script.toString())._();
|
html.script().$type("text/javascript")._(script.toString())._();
|
||||||
}
|
}
|
||||||
@ -135,8 +136,8 @@ protected void render(Block html) {
|
|||||||
StringEscapeUtils.escapeHtml(ta.getStatus()))).append("\",\"")
|
StringEscapeUtils.escapeHtml(ta.getStatus()))).append("\",\"")
|
||||||
|
|
||||||
.append(nodeHttpAddr == null ? "N/A" :
|
.append(nodeHttpAddr == null ? "N/A" :
|
||||||
"<a class='nodelink' href='" + MRWebAppUtil.getYARNWebappScheme() + nodeHttpAddr + "'>"
|
"<a class='nodelink' href='" + MRWebAppUtil.getYARNWebappScheme() + nodeHttpAddr + "'>"
|
||||||
+ nodeHttpAddr + "</a>")
|
+ nodeHttpAddr + "</a>")
|
||||||
.append("\",\"")
|
.append("\",\"")
|
||||||
|
|
||||||
.append(ta.getAssignedContainerId() == null ? "N/A" :
|
.append(ta.getAssignedContainerId() == null ? "N/A" :
|
||||||
@ -151,12 +152,21 @@ protected void render(Block html) {
|
|||||||
.append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
.append(StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
||||||
diag)));
|
diag)));
|
||||||
if (enableUIActions) {
|
if (enableUIActions) {
|
||||||
attemptsTableData.append("\",\"")
|
attemptsTableData.append("\",\"");
|
||||||
.append("<a href=javascript:void(0) onclick=confirmAction('")
|
if (EnumSet.of(
|
||||||
.append(String.format(stateURLFormat, ta.getId()))
|
TaskAttemptState.SUCCEEDED,
|
||||||
.append("');>Kill</a>")
|
TaskAttemptState.FAILED,
|
||||||
.append("\"],\n");
|
TaskAttemptState.KILLED).contains(attempt.getState())) {
|
||||||
} else {
|
attemptsTableData.append("N/A");
|
||||||
|
} else {
|
||||||
|
attemptsTableData
|
||||||
|
.append("<a href=javascript:void(0) onclick=confirmAction('")
|
||||||
|
.append(jobId.getAppId()).append("','")
|
||||||
|
.append(jobId).append("','")
|
||||||
|
.append(attempt.getID().getTaskId()).append("','")
|
||||||
|
.append(ta.getId())
|
||||||
|
.append("');>Kill</a>");
|
||||||
|
}
|
||||||
attemptsTableData.append("\"],\n");
|
attemptsTableData.append("\"],\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user