MAPREDUCE-3023. Fixed clients to display queue state correctly. Contributed by Ravi Prakash.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1173458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1d067c6e2b
commit
0e870d7d18
@ -1378,6 +1378,9 @@ Release 0.23.0 - Unreleased
|
|||||||
MAPREDUCE-2998. Fixed a bug in TaskAttemptImpl which caused it to fork
|
MAPREDUCE-2998. Fixed a bug in TaskAttemptImpl which caused it to fork
|
||||||
bin/mapred too many times. (vinodkv via acmurthy)
|
bin/mapred too many times. (vinodkv via acmurthy)
|
||||||
|
|
||||||
|
MAPREDUCE-3023. Fixed clients to display queue state correctly. (Ravi
|
||||||
|
Prakash via acmurthy)
|
||||||
|
|
||||||
Release 0.22.0 - Unreleased
|
Release 0.22.0 - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ApplicationState;
|
import org.apache.hadoop.yarn.api.records.ApplicationState;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeReport;
|
import org.apache.hadoop.yarn.api.records.NodeReport;
|
||||||
import org.apache.hadoop.yarn.api.records.QueueACL;
|
import org.apache.hadoop.yarn.api.records.QueueACL;
|
||||||
|
import org.apache.hadoop.yarn.api.records.QueueState;
|
||||||
import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
|
import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
|
||||||
import org.apache.hadoop.yarn.factories.RecordFactory;
|
import org.apache.hadoop.yarn.factories.RecordFactory;
|
||||||
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
|
||||||
@ -290,6 +291,15 @@ public static org.apache.hadoop.mapred.JobStatus fromYarn(
|
|||||||
jobFile, trackingUrl);
|
jobFile, trackingUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static org.apache.hadoop.mapreduce.QueueState fromYarn(
|
||||||
|
QueueState state) {
|
||||||
|
org.apache.hadoop.mapreduce.QueueState qState =
|
||||||
|
org.apache.hadoop.mapreduce.QueueState.getState(
|
||||||
|
state.toString().toLowerCase());
|
||||||
|
return qState;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int fromYarn(JobState state) {
|
public static int fromYarn(JobState state) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NEW:
|
case NEW:
|
||||||
@ -431,9 +441,9 @@ public static JobStatus[] fromYarnApps(List<ApplicationReport> applications,
|
|||||||
|
|
||||||
public static QueueInfo fromYarn(org.apache.hadoop.yarn.api.records.QueueInfo
|
public static QueueInfo fromYarn(org.apache.hadoop.yarn.api.records.QueueInfo
|
||||||
queueInfo, Configuration conf) {
|
queueInfo, Configuration conf) {
|
||||||
return new QueueInfo(queueInfo.getQueueName(),
|
return new QueueInfo(queueInfo.getQueueName(),queueInfo.toString(),
|
||||||
queueInfo.toString(), QueueState.RUNNING,
|
fromYarn(queueInfo.getQueueState()), TypeConverter.fromYarnApps(
|
||||||
TypeConverter.fromYarnApps(queueInfo.getApplications(), conf));
|
queueInfo.getApplications(), conf));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static QueueInfo[] fromYarnQueueInfo(
|
public static QueueInfo[] fromYarnQueueInfo(
|
||||||
|
@ -19,11 +19,14 @@
|
|||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationState;
|
import org.apache.hadoop.yarn.api.records.ApplicationState;
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
|
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
|
||||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
|
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationReportPBImpl;
|
||||||
|
import org.apache.hadoop.yarn.api.records.impl.pb.QueueInfoPBImpl;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@ -67,4 +70,14 @@ public void testFromYarnApplicationReport() {
|
|||||||
Assert.assertEquals("jobId set incorrectly", 6789, status.getJobID().getId());
|
Assert.assertEquals("jobId set incorrectly", 6789, status.getJobID().getId());
|
||||||
Assert.assertEquals("state set incorrectly", JobStatus.State.KILLED, status.getState());
|
Assert.assertEquals("state set incorrectly", JobStatus.State.KILLED, status.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFromYarnQueueInfo() {
|
||||||
|
org.apache.hadoop.yarn.api.records.QueueInfo queueInfo = new QueueInfoPBImpl();
|
||||||
|
queueInfo.setQueueState(org.apache.hadoop.yarn.api.records.QueueState.STOPPED);
|
||||||
|
org.apache.hadoop.mapreduce.QueueInfo returned =
|
||||||
|
TypeConverter.fromYarn(queueInfo, new Configuration());
|
||||||
|
Assert.assertEquals("queueInfo translation didn't work.",
|
||||||
|
returned.getState().toString(), queueInfo.getQueueState().toString().toLowerCase());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user