/** * Remove the child from this {@link JobQueueInfo}. This also resets the * queue-name of the child from a fully-qualified name to a simple queue name. * * Only for testing. * * @param child */ void removeChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.remove(child); setChildren(children); }
/** * Remove the child from this {@link JobQueueInfo}. This also resets the * queue-name of the child from a fully-qualified name to a simple queue name. * * Only for testing. * * @param child */ void removeChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.remove(child); setChildren(children); }
/** * Add a child {@link JobQueueInfo} to this {@link JobQueueInfo}. Modify the * fully-qualified name of the child {@link JobQueueInfo} to reflect the * hierarchy. * * Only for testing. * * @param child */ void addChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.add(child); setChildren(children); }
/** * Remove the child from this {@link JobQueueInfo}. This also resets the * queue-name of the child from a fully-qualified name to a simple queue name. * * Only for testing. * * @param child */ void removeChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.remove(child); setChildren(children); }
/** * Expands the hierarchy of queues and gives the list of all queues in * depth-first order * @param rootQueues the top-level queues * @return the list of all the queues in depth-first order. */ List<JobQueueInfo> expandQueueList(JobQueueInfo[] rootQueues) { List<JobQueueInfo> allQueues = new ArrayList<JobQueueInfo>(); for (JobQueueInfo queue : rootQueues) { allQueues.add(queue); if (queue.getChildren() != null) { JobQueueInfo[] childQueues = queue.getChildren().toArray(new JobQueueInfo[0]); allQueues.addAll(expandQueueList(childQueues)); } } return allQueues; }
/** * Expands the hierarchy of queues and gives the list of all queues in * depth-first order * @param rootQueues the top-level queues * @return the list of all the queues in depth-first order. */ List<JobQueueInfo> expandQueueList(JobQueueInfo[] rootQueues) { List<JobQueueInfo> allQueues = new ArrayList<JobQueueInfo>(); for (JobQueueInfo queue : rootQueues) { allQueues.add(queue); if (queue.getChildren() != null) { JobQueueInfo[] childQueues = queue.getChildren().toArray(new JobQueueInfo[0]); allQueues.addAll(expandQueueList(childQueues)); } } return allQueues; }
/** * Remove the child from this {@link JobQueueInfo}. This also resets the * queue-name of the child from a fully-qualified name to a simple queue name. * * Only for testing. * * @param child */ void removeChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.remove(child); setChildren(children); }
/** * Remove the child from this {@link JobQueueInfo}. This also resets the * queue-name of the child from a fully-qualified name to a simple queue name. * * Only for testing. * * @param child */ void removeChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.remove(child); setChildren(children); }
/** * Expands the hierarchy of queues and gives the list of all queues in * depth-first order * @param rootQueues the top-level queues * @return the list of all the queues in depth-first order. */ List<JobQueueInfo> expandQueueList(JobQueueInfo[] rootQueues) { List<JobQueueInfo> allQueues = new ArrayList<JobQueueInfo>(); for (JobQueueInfo queue : rootQueues) { allQueues.add(queue); if (queue.getChildren() != null) { JobQueueInfo[] childQueues = queue.getChildren().toArray(new JobQueueInfo[0]); allQueues.addAll(expandQueueList(childQueues)); } } return allQueues; }
/** * Add a child {@link JobQueueInfo} to this {@link JobQueueInfo}. Modify the * fully-qualified name of the child {@link JobQueueInfo} to reflect the * hierarchy. * * Only for testing. * * @param child */ void addChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.add(child); setChildren(children); }
/** * Add a child {@link JobQueueInfo} to this {@link JobQueueInfo}. Modify the * fully-qualified name of the child {@link JobQueueInfo} to reflect the * hierarchy. * * Only for testing. * * @param child */ void addChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.add(child); setChildren(children); }
/** * Add a child {@link JobQueueInfo} to this {@link JobQueueInfo}. Modify the * fully-qualified name of the child {@link JobQueueInfo} to reflect the * hierarchy. * * Only for testing. * * @param child */ void addChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.add(child); setChildren(children); }
/** * Add a child {@link JobQueueInfo} to this {@link JobQueueInfo}. Modify the * fully-qualified name of the child {@link JobQueueInfo} to reflect the * hierarchy. * * Only for testing. * * @param child */ void addChild(JobQueueInfo child) { List<JobQueueInfo> children = getChildren(); children.add(child); setChildren(children); }
assertEquals(firstSubQueue.getJobQueueInfo().getSchedulingInfo(), "queueInfo"); assertEquals(secondSubQueue.getJobQueueInfo().getChildren().size(), 0);
/** * Get the complete hierarchy of children for queue * queueName * * @param queueName * @return */ JobQueueInfo[] getChildQueues(String queueName) { List<JobQueueInfo> list = allQueues.get(queueName).getJobQueueInfo().getChildren(); if (list != null) { return list.toArray(new JobQueueInfo[list.size()]); } else { return new JobQueueInfo[0]; } }
/** * Return an array of {@link JobQueueInfo} objects for the root * queues configured in the system. * <p/> * Root queues are queues that are at the top-most level in the * hierarchy of queues in mapred-queues.xml, or they are the queues * configured in the mapred.queue.names key in mapred-site.xml. * * @return array of JobQueueInfo objects for root level queues. */ JobQueueInfo[] getRootQueues() { List<JobQueueInfo> list = getRoot().getJobQueueInfo().getChildren(); return list.toArray(new JobQueueInfo[list.size()]); }
private static String getTree(String parent, List<JobQueueInfo> children) { StringBuilder str = new StringBuilder(); if (children == null) { return ""; } for (JobQueueInfo queueInfo : children) { String variableName = StringUtils.replaceChars(queueInfo.getQueueName(), ":-*+#.^", "_______"); String label = queueInfo.getQueueName().split(":")[queueInfo .getQueueName().split(":").length - 1]; str.append(String.format( "var %sTreeNode = new YAHOO.widget.MenuNode(\"%s\", %s, false);\n", variableName, label, parent)); str.append(String.format("%sTreeNode.data=\"%s\";\n", variableName, queueInfo.getSchedulingInfo().replaceAll("\n", "<br/>"))); str.append(String.format("%sTreeNode.name=\"%s\";\n", variableName, queueInfo.getQueueName())); str.append(getTree(variableName + "TreeNode", queueInfo.getChildren())); } return str.toString(); }
private void updateSchedulerProps(JobQueueInfo jqi) { LOG.info("Updating properties for SchedulerQueue " + jqi.getQueueName()); LOG.info("Putting " + jqi.getProperties() + " in " + jqi.getQueueName()); schedulerPropsMap.put(jqi.getQueueName(), jqi.getProperties()); for (JobQueueInfo child : jqi.getChildren()) { updateSchedulerProps(child); } }
private QueueInfo[] getQueueInfoArray(JobQueueInfo[] queues) throws IOException { for (JobQueueInfo queue : queues) { queue.setJobStatuses(getJobsFromQueue(queue.getQueueName())); for(JobQueueInfo childqueue : queue.getChildren()){ childqueue.setJobStatuses(getJobsFromQueue(childqueue.getQueueName())); } } return queues; }
@Test public void testMissingConfigFile() throws Exception { deleteQueuesConfigFile(); // deletes file try { new QueueManager(QUEUES_CONFIG_FILE_PATH, true); fail("Should throw an exception for missing file when " + "explicitly passed."); } catch (RuntimeException re) { } // If we just want to pick up the queues from the class loader // it should fall through to the default. The class loader is set to // load CONFIG for the "mapred-queues.xml" resource, but it's missing // so should fall through to mapred-queues-default.xml QueueManager qm = new QueueManager(); List<JobQueueInfo> rootQueues = qm.getRoot().getJobQueueInfo().getChildren(); assertEquals(1, rootQueues.size()); assertEquals("default", rootQueues.get(0).getQueueName()); }