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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1190110 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mahadev Konar 2011-10-28 01:16:29 +00:00
parent 659ea4c540
commit 35b62e6e72
3 changed files with 33 additions and 0 deletions

View File

@ -1821,6 +1821,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;