/** * Test that print job queue recursively prints child queues */ @Test @SuppressWarnings("deprecation") public void testPrintJobQueueInfo() throws IOException { JobQueueClient queueClient = new JobQueueClient(); JobQueueInfo parent = new JobQueueInfo(); JobQueueInfo child = new JobQueueInfo(); JobQueueInfo grandChild = new JobQueueInfo(); child.addChild(grandChild); parent.addChild(child); grandChild.setQueueName("GrandChildQueue"); ByteArrayOutputStream bbos = new ByteArrayOutputStream(); PrintWriter writer = new PrintWriter(bbos); queueClient.printJobQueueInfo(parent, writer); Assert.assertTrue("printJobQueueInfo did not print grandchild's name", bbos.toString().contains("GrandChildQueue")); }
private JobQueueInfo[] getJobQueueInfoArray(QueueInfo[] queues) throws IOException { JobQueueInfo[] ret = new JobQueueInfo[queues.length]; for (int i = 0; i < queues.length; i++) { ret[i] = new JobQueueInfo(queues[i]); } return ret; }
JobQueueInfo getJobQueueInfo(String queue) { Object schedulingInfo = schedulerInfoObjects.get(queue); if(schedulingInfo!=null){ return new JobQueueInfo(queue,schedulingInfo.toString()); }else { return new JobQueueInfo(queue,null); } }
JobQueueInfo getJobQueueInfo(String queue) { Object schedulingInfo = schedulerInfoObjects.get(queue); if(schedulingInfo!=null){ return new JobQueueInfo(queue,schedulingInfo.toString()); }else { return new JobQueueInfo(queue,null); } } }
synchronized JobQueueInfo[] getJobQueueInfos() { ArrayList<JobQueueInfo> queueInfoList = new ArrayList<JobQueueInfo>(); for(String queue : queueNames) { Object schedulerInfo = schedulerInfoObjects.get(queue); if(schedulerInfo != null) { queueInfoList.add(new JobQueueInfo(queue,schedulerInfo.toString())); }else { queueInfoList.add(new JobQueueInfo(queue,null)); } } return (JobQueueInfo[]) queueInfoList.toArray(new JobQueueInfo[queueInfoList .size()]); }
synchronized JobQueueInfo[] getJobQueueInfos() { ArrayList<JobQueueInfo> queueInfoList = new ArrayList<JobQueueInfo>(); for(String queue : queueNames) { Object schedulerInfo = schedulerInfoObjects.get(queue); if(schedulerInfo != null) { queueInfoList.add(new JobQueueInfo(queue,schedulerInfo.toString())); }else { queueInfoList.add(new JobQueueInfo(queue,null)); } } return (JobQueueInfo[]) queueInfoList.toArray(new JobQueueInfo[queueInfoList .size()]); }
public List<JobQueueInfo> getChildren() { List<JobQueueInfo> list = new ArrayList<JobQueueInfo>(); for (QueueInfo q : super.getQueueChildren()) { list.add(q instanceof JobQueueInfo? (JobQueueInfo)q : new JobQueueInfo(q)); } return list; }
/** * Gets the queue information associated to a particular Job Queue * * @param queueName name of the job queue. * @return Queue information associated to particular queue. * @throws IOException */ public JobQueueInfo getQueueInfo(final String queueName) throws IOException { try { QueueInfo queueInfo = clientUgi.doAs(new PrivilegedExceptionAction<QueueInfo>() { public QueueInfo run() throws IOException, InterruptedException { return cluster.getQueue(queueName); } }); if (queueInfo != null) { return new JobQueueInfo(queueInfo); } return null; } catch (InterruptedException ie) { throw new IOException(ie); } }
/** * Gets the queue information associated to a particular Job Queue * * @param queueName name of the job queue. * @return Queue information associated to particular queue. * @throws IOException */ public JobQueueInfo getQueueInfo(final String queueName) throws IOException { try { QueueInfo queueInfo = clientUgi.doAs(new PrivilegedExceptionAction<QueueInfo>() { public QueueInfo run() throws IOException, InterruptedException { return cluster.getQueue(queueName); } }); if (queueInfo != null) { return new JobQueueInfo(queueInfo); } return null; } catch (InterruptedException ie) { throw new IOException(ie); } }
/** * Gets the queue information associated to a particular Job Queue * * @param queueName name of the job queue. * @return Queue information associated to particular queue. * @throws IOException */ public JobQueueInfo getQueueInfo(final String queueName) throws IOException { try { QueueInfo queueInfo = clientUgi.doAs(new PrivilegedExceptionAction<QueueInfo>() { public QueueInfo run() throws IOException, InterruptedException { return cluster.getQueue(queueName); } }); if (queueInfo != null) { return new JobQueueInfo(queueInfo); } return null; } catch (InterruptedException ie) { throw new IOException(ie); } }
/** * Gets the queue information associated to a particular Job Queue * * @param queueName name of the job queue. * @return Queue information associated to particular queue. * @throws IOException */ public JobQueueInfo getQueueInfo(final String queueName) throws IOException { try { QueueInfo queueInfo = clientUgi.doAs(new PrivilegedExceptionAction<QueueInfo>() { public QueueInfo run() throws IOException, InterruptedException { return cluster.getQueue(queueName); } }); if (queueInfo != null) { return new JobQueueInfo(queueInfo); } return null; } catch (InterruptedException ie) { throw new IOException(ie); } }
/** * Gets the queue information associated to a particular Job Queue * * @param queueName name of the job queue. * @return Queue information associated to particular queue. * @throws IOException */ public JobQueueInfo getQueueInfo(String queueName) throws IOException { try { QueueInfo queueInfo = cluster.getQueue(queueName); if (queueInfo != null) { return new JobQueueInfo(queueInfo); } return null; } catch (InterruptedException ie) { throw new IOException(ie); } }
@Test public void testQueueInfoPrinting() throws Exception { // create a test queue with children. // create some sample queues in a hierarchy.. JobQueueInfo root = new JobQueueInfo("q1", "q1 scheduling info"); List<JobQueueInfo> children = new ArrayList<JobQueueInfo>(); children.add(new JobQueueInfo("q1:1", null)); children.add(new JobQueueInfo("q1:2", null)); root.setChildren(children); JobQueueClient client = new JobQueueClient(new JobConf()); StringWriter writer = new StringWriter(); client.printJobQueueInfo(root, writer); StringBuffer sb = new StringBuffer(); sb.append("Queue Name : q1 \n"); sb.append("Queue State : running \n"); sb.append("Scheduling Info : q1 scheduling info \n"); sb.append("Child Queues : q1:1, q1:2\n"); sb.append("======================\n"); assertEquals(sb.toString(), writer.toString()); }
private JobQueueInfo getJobQueueInfo(QueueInfo queue) { JobQueueInfo ret = new JobQueueInfo(queue); // make sure to convert any children if (queue.getQueueChildren().size() > 0) { List<JobQueueInfo> childQueues = new ArrayList<JobQueueInfo>(queue .getQueueChildren().size()); for (QueueInfo child : queue.getQueueChildren()) { childQueues.add(getJobQueueInfo(child)); } ret.setChildren(childQueues); } return ret; }
private JobQueueInfo getJobQueueInfo(QueueInfo queue) { JobQueueInfo ret = new JobQueueInfo(queue); // make sure to convert any children if (queue.getQueueChildren().size() > 0) { List<JobQueueInfo> childQueues = new ArrayList<JobQueueInfo>(queue .getQueueChildren().size()); for (QueueInfo child : queue.getQueueChildren()) { childQueues.add(getJobQueueInfo(child)); } ret.setChildren(childQueues); } return ret; }
private JobQueueInfo getJobQueueInfo(QueueInfo queue) { JobQueueInfo ret = new JobQueueInfo(queue); // make sure to convert any children if (queue.getQueueChildren().size() > 0) { List<JobQueueInfo> childQueues = new ArrayList<JobQueueInfo>(queue .getQueueChildren().size()); for (QueueInfo child : queue.getQueueChildren()) { childQueues.add(getJobQueueInfo(child)); } ret.setChildren(childQueues); } return ret; }
private JobQueueInfo getJobQueueInfo(QueueInfo queue) { JobQueueInfo ret = new JobQueueInfo(queue); // make sure to convert any children if (queue.getQueueChildren().size() > 0) { List<JobQueueInfo> childQueues = new ArrayList<JobQueueInfo>(queue .getQueueChildren().size()); for (QueueInfo child : queue.getQueueChildren()) { childQueues.add(getJobQueueInfo(child)); } ret.setChildren(childQueues); } return ret; }
@Test public void testQueueOrdering() throws Exception { // create some sample queues in a hierarchy.. JobQueueInfo[] roots = new JobQueueInfo[2]; roots[0] = new JobQueueInfo("q1", "q1 scheduling info"); roots[1] = new JobQueueInfo("q2", "q2 scheduling info"); List<JobQueueInfo> children = new ArrayList<JobQueueInfo>(); children.add(new JobQueueInfo("q1:1", null)); children.add(new JobQueueInfo("q1:2", null)); roots[0].setChildren(children); // test dfs ordering JobQueueClient client = new JobQueueClient(new JobConf()); List<JobQueueInfo> allQueues = client.expandQueueList(roots); assertEquals(4, allQueues.size()); assertEquals("q1", allQueues.get(0).getQueueName()); assertEquals("q1:1", allQueues.get(1).getQueueName()); assertEquals("q1:2", allQueues.get(2).getQueueName()); assertEquals("q2", allQueues.get(3).getQueueName()); }
JobQueueInfo queueInfo = new JobQueueInfo(); queueInfo.setQueueName(name); LOG.debug("created jobQInfo " + queueInfo.getQueueName());
static JobQueueInfo newJobQueueInfo(List<JobQueueInfo> children, Properties props, String queueName, QueueState state, String schedulingInfo) { JobQueueInfo jqi = new JobQueueInfo(); jqi.setChildren(children); if (props != null) { jqi.setProperties(props); } jqi.setQueueName(queueName); jqi.setQueueState(state.getStateName()); jqi.setSchedulingInfo(schedulingInfo); return jqi; } }