MAPREDUCE-3282. bin/mapred job -list throws exception. (acmurthy via mahadev) - Merging r1190110 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1190112 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mahadev Konar 2011-10-28 01:19:09 +00:00
parent 80db1adaa7
commit 0b0404822c
3 changed files with 33 additions and 0 deletions

View File

@ -1760,6 +1760,9 @@ Release 0.23.0 - Unreleased
MAPREDUCE-3284. Moved JobQueueClient to hadoop-mapreduce-client-core.
(acmurthy)
MAPREDUCE-3282. bin/mapred job -list throws exception. (acmurthy via
mahadev)
Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES

View File

@ -380,6 +380,7 @@ public class TypeConverter {
public static JobStatus.State fromYarn(YarnApplicationState state) {
switch (state) {
case NEW:
case SUBMITTED:
return State.PREP;
case RUNNING:

View File

@ -20,6 +20,9 @@ package org.apache.hadoop.mapreduce;
import junit.framework.Assert;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.v2.api.records.JobState;
import org.apache.hadoop.mapreduce.v2.api.records.TaskState;
import org.apache.hadoop.mapreduce.v2.api.records.TaskType;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
@ -28,12 +31,38 @@ import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationResourceUsageReportPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.QueueInfoPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.api.records.QueueState;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.junit.Test;
public class TestTypeConverter {
@Test
public void testEnums() throws Exception {
for (YarnApplicationState applicationState : YarnApplicationState.values()) {
TypeConverter.fromYarn(applicationState);
}
for (TaskType taskType : TaskType.values()) {
TypeConverter.fromYarn(taskType);
}
for (JobState jobState : JobState.values()) {
TypeConverter.fromYarn(jobState);
}
for (QueueState queueState : QueueState.values()) {
TypeConverter.fromYarn(queueState);
}
for (TaskState taskState : TaskState.values()) {
TypeConverter.fromYarn(taskState);
}
}
@Test
public void testFromYarn() throws Exception {
int appStartTime = 612354;