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:
parent
9db8505b19
commit
6072cb98a9
|
@ -43,6 +43,9 @@ Release 2.0.4-beta - UNRELEASED
|
||||||
MAPREDUCE-4693. History server should include counters for failed tasks.
|
MAPREDUCE-4693. History server should include counters for failed tasks.
|
||||||
(Xuan Gong via sseth)
|
(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
|
Release 2.0.3-alpha - 2013-02-06
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -106,8 +106,9 @@ public class ResourceMgrDelegate extends YarnClientImpl {
|
||||||
|
|
||||||
public QueueInfo getQueue(String queueName) throws IOException,
|
public QueueInfo getQueue(String queueName) throws IOException,
|
||||||
InterruptedException {
|
InterruptedException {
|
||||||
return TypeConverter.fromYarn(
|
org.apache.hadoop.yarn.api.records.QueueInfo queueInfo =
|
||||||
super.getQueueInfo(queueName), this.conf);
|
super.getQueueInfo(queueName);
|
||||||
|
return (queueInfo == null) ? null : TypeConverter.fromYarn(queueInfo, conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
|
public QueueAclsInfo[] getQueueAclsForCurrentUser() throws IOException,
|
||||||
|
|
|
@ -436,7 +436,6 @@ public class ClientRMService extends AbstractService implements
|
||||||
response.setQueueInfo(queueInfo);
|
response.setQueueInfo(queueInfo);
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
LOG.info("Failed to getQueueInfo for " + request.getQueueName(), ioe);
|
LOG.info("Failed to getQueueInfo for " + request.getQueueName(), ioe);
|
||||||
throw RPCUtil.getRemoteException(ioe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -965,7 +965,7 @@ public class FairScheduler implements ResourceScheduler {
|
||||||
public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues,
|
public QueueInfo getQueueInfo(String queueName, boolean includeChildQueues,
|
||||||
boolean recursive) throws IOException {
|
boolean recursive) throws IOException {
|
||||||
if (!queueMgr.exists(queueName)) {
|
if (!queueMgr.exists(queueName)) {
|
||||||
return null;
|
throw new IOException("queue " + queueName + " does not exist");
|
||||||
}
|
}
|
||||||
return queueMgr.getQueue(queueName).getQueueInfo(includeChildQueues,
|
return queueMgr.getQueue(queueName).getQueueInfo(includeChildQueues,
|
||||||
recursive);
|
recursive);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager;
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
||||||
|
|
||||||
import static org.mockito.Matchers.anyBoolean;
|
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.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
@ -176,6 +176,10 @@ public class TestClientRMService {
|
||||||
List<ApplicationReport> applications = queueInfo.getQueueInfo()
|
List<ApplicationReport> applications = queueInfo.getQueueInfo()
|
||||||
.getApplications();
|
.getApplications();
|
||||||
Assert.assertEquals(2, applications.size());
|
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 =
|
private static final UserGroupInformation owner =
|
||||||
|
@ -334,8 +338,10 @@ public class TestClientRMService {
|
||||||
when(rmContext.getDispatcher()).thenReturn(dispatcher);
|
when(rmContext.getDispatcher()).thenReturn(dispatcher);
|
||||||
QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
|
QueueInfo queInfo = recordFactory.newRecordInstance(QueueInfo.class);
|
||||||
queInfo.setQueueName("testqueue");
|
queInfo.setQueueName("testqueue");
|
||||||
when(yarnScheduler.getQueueInfo(anyString(), anyBoolean(), anyBoolean()))
|
when(yarnScheduler.getQueueInfo(eq("testqueue"), anyBoolean(), anyBoolean()))
|
||||||
.thenReturn(queInfo);
|
.thenReturn(queInfo);
|
||||||
|
when(yarnScheduler.getQueueInfo(eq("nonexistentqueue"), anyBoolean(), anyBoolean()))
|
||||||
|
.thenThrow(new IOException("queue does not exist"));
|
||||||
ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
|
ConcurrentHashMap<ApplicationId, RMApp> apps = getRMApps(rmContext,
|
||||||
yarnScheduler);
|
yarnScheduler);
|
||||||
when(rmContext.getRMApps()).thenReturn(apps);
|
when(rmContext.getRMApps()).thenReturn(apps);
|
||||||
|
|
Loading…
Reference in New Issue