MAPREDUCE-4896. mapred queue -info spits out ugly exception when queue does not exist. (sandyr via tucu)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1451453 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2013-03-01 01:28:50 +00:00
parent 9db8505b19
commit 6072cb98a9
5 changed files with 15 additions and 6 deletions

View File

@ -43,6 +43,9 @@ Release 2.0.4-beta - UNRELEASED
MAPREDUCE-4693. History server should include counters for failed tasks.
(Xuan Gong via sseth)
MAPREDUCE-4896. mapred queue -info spits out ugly exception when queue does
not exist. (sandyr via tucu)
Release 2.0.3-alpha - 2013-02-06
INCOMPATIBLE CHANGES

View File

@ -106,8 +106,9 @@ public JobID getNewJobID() throws IOException, InterruptedException {
public QueueInfo getQueue(String queueName) throws IOException,
InterruptedException {
return TypeConverter.fromYarn(
super.getQueueInfo(queueName), this.conf);
org.apache.hadoop.yarn.api.records.QueueInfo queueInfo =
super.getQueueInfo(queueName);
return (queueInfo == null) ? null : TypeConverter.fromYarn(queueInfo, conf);
}
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,

View File

@ -436,7 +436,6 @@ public GetQueueInfoResponse getQueueInfo(GetQueueInfoRequest request)
response.setQueueInfo(queueInfo);
} catch (IOException ioe) {
LOG.info("Failed to getQueueInfo for " + request.getQueueName(), ioe);
throw RPCUtil.getRemoteException(ioe);
}
return response;

View File

@ -965,7 +965,7 @@ public synchronized void reinitialize(Configuration conf, RMContext rmContext)
public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues,
boolean recursive) throws IOException {
if (!queueMgr.exists(queueName)) {
return null;
throw new IOException("queue " + queueName + " does not exist");
}
return queueMgr.getQueue(queueName).getQueueInfo(includeChildQueues,
recursive);

View File

@ -19,7 +19,7 @@
package org.apache.hadoop.yarn.server.resourcemanager;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -176,6 +176,10 @@ public void testGetQueueInfo() throws Exception {
List<ApplicationReport> applications = queueInfo.getQueueInfo()
.getApplications();
Assert.assertEquals(2, applications.size());
request.setQueueName("nonexistentqueue");
request.setIncludeApplications(true);
// should not throw exception on nonexistent queue
queueInfo = rmService.getQueueInfo(request);
}
private static final UserGroupInformation owner =
@ -334,8 +338,10 @@ private void mockRMContext(YarnScheduler yarnScheduler, RMContext rmContext)
when(rmContext.getDispatcher()).thenReturn(dispatcher);
QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
queInfo.setQueueName("testqueue");
when(yarnScheduler.getQueueInfo(anyString(), anyBoolean(), anyBoolean()))
when(yarnScheduler.getQueueInfo(eq("testqueue"), anyBoolean(), anyBoolean()))
.thenReturn(queInfo);
when(yarnScheduler.getQueueInfo(eq("nonexistentqueue"), anyBoolean(), anyBoolean()))
.thenThrow(new IOException("queue does not exist"));
ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
yarnScheduler);
when(rmContext.getRMApps()).thenReturn(apps);