MAPREDUCE-6419. JobHistoryServer doesn't sort properly based on Job ID when Job id's exceed 9999. (Mohammad Shahid Khan via rohithsharmaks)

(cherry picked from commit a308e86621)
This commit is contained in:
Rohith Sharma K S 2015-12-24 11:55:42 +05:30 committed by rohithsharmaks
parent ce74b17028
commit 550840f402
4 changed files with 31 additions and 2 deletions

View File

@ -367,6 +367,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-6550. archive-logs tool changes log ownership to the Yarn MAPREDUCE-6550. archive-logs tool changes log ownership to the Yarn
user when using DefaultContainerExecutor (rkanter) user when using DefaultContainerExecutor (rkanter)
MAPREDUCE-6419. JobHistoryServer doesn't sort properly based on Job ID when Job id's
exceed 9999. (Mohammad Shahid Khan via rohithsharmaks)
Release 2.7.3 - UNRELEASED Release 2.7.3 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -298,7 +298,7 @@ public class HsTaskPage extends HsView {
.append("\n{'aTargets': [ 4 ]") .append("\n{'aTargets': [ 4 ]")
.append(", 'bSearchable': false }") .append(", 'bSearchable': false }")
.append("\n, {'sType':'numeric', 'aTargets': [ 0 ]") .append("\n, {'sType':'natural', 'aTargets': [ 0 ]")
.append(", 'mRender': parseHadoopID }") .append(", 'mRender': parseHadoopID }")
.append("\n, {'sType':'numeric', 'aTargets': [ 5, 6") .append("\n, {'sType':'numeric', 'aTargets': [ 5, 6")

View File

@ -76,7 +76,7 @@ public class HsTasksPage extends HsView {
.append(", bProcessing: true") .append(", bProcessing: true")
.append("\n, aoColumnDefs: [\n") .append("\n, aoColumnDefs: [\n")
.append("{'sType':'string', 'aTargets': [ 0 ]") .append("{'sType':'natural', 'aTargets': [ 0 ]")
.append(", 'mRender': parseHadoopID }") .append(", 'mRender': parseHadoopID }")
.append(", {'sType':'numeric', 'aTargets': [ 4") .append(", {'sType':'numeric', 'aTargets': [ 4")

View File

@ -46,8 +46,10 @@ import org.apache.hadoop.mapreduce.v2.app.MockJobs;
import org.apache.hadoop.mapreduce.v2.app.webapp.TestAMWebApp; import org.apache.hadoop.mapreduce.v2.app.webapp.TestAMWebApp;
import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.webapp.View;
import org.apache.hadoop.yarn.webapp.log.AggregatedLogsPage; import org.apache.hadoop.yarn.webapp.log.AggregatedLogsPage;
import org.apache.hadoop.yarn.webapp.test.WebAppTests; import org.apache.hadoop.yarn.webapp.test.WebAppTests;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import com.google.inject.AbstractModule; import com.google.inject.AbstractModule;
@ -80,6 +82,18 @@ public class TestHSWebApp {
params); params);
} }
@Test
public void testTasksViewNaturalSortType() {
LOG.info("HsTasksPage");
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
Injector testPage = WebAppTests.testPage(HsTasksPage.class, AppContext.class, appContext, params);
View viewInstance = testPage.getInstance(HsTasksPage.class);
Map<String, String> moreParams = viewInstance.context().requestContext().moreParams();
String appTableColumnsMeta = moreParams.get("ui.dataTables.selector.init");
Assert.assertTrue(appTableColumnsMeta.indexOf("natural") != -1);
}
@Test @Test
public void testTaskView() { public void testTaskView() {
LOG.info("HsTaskPage"); LOG.info("HsTaskPage");
@ -89,6 +103,18 @@ public class TestHSWebApp {
.testPage(HsTaskPage.class, AppContext.class, appContext, params); .testPage(HsTaskPage.class, AppContext.class, appContext, params);
} }
@Test
public void testTaskViewNaturalSortType() {
LOG.info("HsTaskPage");
AppContext appContext = new MockAppContext(0, 1, 1, 1);
Map<String, String> params = TestAMWebApp.getTaskParams(appContext);
Injector testPage = WebAppTests.testPage(HsTaskPage.class, AppContext.class, appContext, params);
View viewInstance = testPage.getInstance(HsTaskPage.class);
Map<String, String> moreParams = viewInstance.context().requestContext().moreParams();
String appTableColumnsMeta = moreParams.get("ui.dataTables.attempts.init");
Assert.assertTrue(appTableColumnsMeta.indexOf("natural") != -1);
}
@Test public void testAttemptsWithJobView() { @Test public void testAttemptsWithJobView() {
LOG.info("HsAttemptsPage with data"); LOG.info("HsAttemptsPage with data");
MockAppContext ctx = new MockAppContext(0, 1, 1, 1); MockAppContext ctx = new MockAppContext(0, 1, 1, 1);