| | 11 | 假设又两条queue:default,highPrior,当default被占满后,而highPrior比较空闲[[BR]] |
| | 12 | 优先级是HIGH的会被分配到highPrior队列[[BR]] |
| | 13 | |
| | 14 | 修改JobQueueManager,jobAdded 函数 |
| | 15 | |
| | 16 | |
| | 17 | {{{ |
| | 18 | @Override |
| | 19 | public void jobAdded(JobInProgress job) throws IOException { |
| | 20 | LOG.info("Job " + job.getJobID() + " submitted to queue " + |
| | 21 | job.getProfile().getQueueName()); |
| | 22 | |
| | 23 | // add job to the right queue |
| | 24 | CapacitySchedulerQueue queue = getQueue(job.getProfile().getQueueName()); |
| | 25 | if (null == queue) { |
| | 26 | // job was submitted to a queue we're not aware of |
| | 27 | LOG.warn("Invalid queue " + job.getProfile().getQueueName() + |
| | 28 | " specified for job" + job.getProfile().getJobID() + |
| | 29 | ". Ignoring job."); |
| | 30 | return; |
| | 31 | } |
| | 32 | // add job to waiting queue. It will end up in the right place, |
| | 33 | // based on priority. |
| | 34 | queue.addWaitingJob(job); |
| | 35 | // let scheduler know. |
| | 36 | scheduler.jobAdded(job); |
| | 37 | } |
| | 38 | }}} |