();
+
+ public void addParameter(String name, String value) {
+ params.put(name, value);
+ }
+
+ public String $(String key, String defaultValue) {
+ String value = params.get(key);
+ return value == null ? defaultValue : value;
+ }
+
+ public AttemptsBlockForTest(App ctx, Configuration conf) {
+ super(ctx, conf);
+ }
+
+ @Override
+ public String url(String... parts) {
+ String result = "url://";
+ for (String string : parts) {
+ result += string + ":";
+ }
+ return result;
+ }
+ }
}
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsAttemptsPage.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsAttemptsPage.java
index 1a6bab9e7df..9233fd3eef8 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsAttemptsPage.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsAttemptsPage.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.mapreduce.v2.app.job.Job;
import org.apache.hadoop.mapreduce.v2.app.job.Task;
import org.apache.hadoop.mapreduce.v2.app.job.TaskAttempt;
import org.apache.hadoop.mapreduce.v2.app.webapp.App;
+import org.apache.hadoop.mapreduce.v2.app.webapp.dao.TaskAttemptInfo;
import org.apache.hadoop.mapreduce.v2.util.MRApps;
import org.apache.hadoop.mapreduce.v2.util.MRApps.TaskAttemptStateUI;
import org.apache.hadoop.yarn.webapp.SubView;
@@ -59,6 +60,12 @@ public class HsAttemptsPage extends HsTaskPage {
return app.getJob() != null;
}
+ @Override
+ protected String getAttemptId(TaskId taskId, TaskAttemptInfo ta) {
+ return "" + ta.getId() + "";
+ }
+
/*
* (non-Javadoc)
* @see org.apache.hadoop.mapreduce.v2.hs.webapp.HsTaskPage.AttemptsBlock#getTaskAttempts()
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTaskPage.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTaskPage.java
index 5bd8684449a..ba75018e46b 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTaskPage.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/webapp/HsTaskPage.java
@@ -143,11 +143,10 @@ public class HsTaskPage extends HsView {
}
long attemptElapsed =
Times.elapsed(attemptStartTime, attemptFinishTime, false);
- int sortId = attempt.getID().getId()
- + (attempt.getID().getTaskId().getId() * 10000);
+ TaskId taskId = attempt.getID().getTaskId();
attemptsTableData.append("[\"")
- .append(sortId + " ").append(taid).append("\",\"")
+ .append(getAttemptId(taskId, ta)).append("\",\"")
.append(ta.getState()).append("\",\"")
.append(StringEscapeUtils.escapeJavaScript(
StringEscapeUtils.escapeHtml(ta.getStatus()))).append("\",\"")
@@ -234,6 +233,10 @@ public class HsTaskPage extends HsView {
footRow._()._()._();
}
+ protected String getAttemptId(TaskId taskId, TaskAttemptInfo ta) {
+ return ta.getId();
+ }
+
/**
* @return true if this is a valid request else false.
*/
@@ -296,7 +299,7 @@ public class HsTaskPage extends HsView {
.append(", 'bSearchable': false }")
.append("\n, {'sType':'numeric', 'aTargets': [ 0 ]")
- .append(", 'mRender': parseHadoopAttemptID }")
+ .append(", 'mRender': parseHadoopID }")
.append("\n, {'sType':'numeric', 'aTargets': [ 5, 6")
//Column numbers are different for maps and reduces
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestBlocks.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestBlocks.java
index b82965a38e8..d1a704f5f0f 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestBlocks.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/test/java/org/apache/hadoop/mapreduce/v2/hs/webapp/TestBlocks.java
@@ -200,7 +200,7 @@ public class TestBlocks {
block.render(html);
pWriter.flush();
// should be printed information about attempts
- assertTrue(data.toString().contains("0 attempt_0_0001_r_000000_0"));
+ assertTrue(data.toString().contains("attempt_0_0001_r_000000_0"));
assertTrue(data.toString().contains("SUCCEEDED"));
assertFalse(data.toString().contains("Processed 128/128 records \n"));
assertTrue(data.toString().contains("Processed 128\\/128 records <p> \\n"));
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
index c9416fd005e..c0032725c43 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/webapps/static/yarn.dt.plugins.js
@@ -146,17 +146,13 @@ function parseHadoopID(data, type, full) {
if (type === 'display') {
return data;
}
- //Return the visible string rather than the entire HTML tag
- return data.split('>')[1].split('<')[0];
-}
-//JSON array element is "20000 attempt_1360183373897_0001_m_000002_0"
-function parseHadoopAttemptID(data, type, full) {
- if (type === 'display' || type === 'filter') {
- return data.split(' ')[1];
- }
- //For sorting use the order as defined in the JSON element
- return data.split(' ')[0];
+ var splits = data.split('>');
+ // Return original string if there is no HTML tag
+ if (splits.length === 1) return data;
+
+ //Return the visible string rather than the entire HTML tag
+ return splits[1].split('<')[0];
}
function parseHadoopProgress(data, type, full) {