1 /* Copyright (c) 2009 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
18 package compbio.engine.cluster.dundee;
\r
19 import static compbio.engine.cluster.dundee._QueueConstraints.*;
\r
21 public enum _Queue {
\r
24 * devel.q 4Gb or 16Gb 8 hour I
\r
25 64bit-pri.q 4Gb or 16Gb 24 hours B
\r
26 64bit.q 4Gb or 16Gb None B
\r
28 bigmem.q 32Gb None B
\r
32 * Order of the constraint reflect the priority of the queue
\r
34 DEVEL(FIRST_MEMORY_LIMIT, SHORT_TIME_LIMIT,"devel.q"),
\r
35 PRIBIT64(FIRST_MEMORY_LIMIT,LONG_TIME_LIMIT,"64bit-pri.q"),
\r
36 BIT64(FIRST_MEMORY_LIMIT,0,"64bit.q"),
\r
37 BIGINT(MAX_MEMORY_LIMIT,SHORT_TIME_LIMIT,"bigint.q"),
\r
38 BIGMEM(MAX_MEMORY_LIMIT,0,"bigmem.q");
\r
44 private _Queue(int maxMemory, int maxRuntime, String qname) {
\r
45 this.maxMemory=maxMemory;
\r
46 this.maxRuntime=maxRuntime;
\r
47 this.qname = qname;
\r
50 // -q 64bit.q -l qname=64bit.q -l h_vmem=8000M -l ram=8000M
\r
52 public String toString() {
\r
58 * @return max runtime in hours
\r
60 public int getTimeLimit() {
\r
61 return this.maxRuntime;
\r
66 * @return true if the queue has time limit, false overwise
\r
68 public boolean hasTimeLimit() {
\r
69 return this.maxRuntime != 0;
\r
72 * return max memory limit in Mb
\r
75 public int getMemoryLimit() {
\r
76 return this.maxMemory;
\r
79 public static _Queue getQueueByMemoryRequirements(int maxMemory) {
\r
80 if(maxMemory>FIRST_MEMORY_LIMIT) {
\r
82 } else if(maxMemory<MAX_MEMORY_LIMIT)
\r
85 throw new UnsupportedOperationException("Cluster does not support tasks requiring more than 30000M of memory");
\r
89 public static _Queue getQueue(int maxMemory, int timeLimitInHours) {
\r
90 if(timeLimitInHours==0) {
\r
91 return getQueueByMemoryRequirements(maxMemory);
\r
93 if(timeLimitInHours<=SHORT_TIME_LIMIT) {
\r
94 if(maxMemory<=FIRST_MEMORY_LIMIT) {
\r
96 }else if(maxMemory<=MAX_MEMORY_LIMIT){
\r
99 throw new UnsupportedOperationException("Cluster does not support tasks requiring more than 30000M of memory");
\r
103 if(timeLimitInHours <= LONG_TIME_LIMIT && maxMemory <=FIRST_MEMORY_LIMIT) {
\r
105 } else if( maxMemory<= MAX_MEMORY_LIMIT){
\r
108 throw new UnsupportedOperationException("Cluster does not support tasks requiring more than 30000M of memory");
\r
114 public _Queue getQueue(String queueName) {
\r
117 if ( queueName.equals(DEVEL.toString())) {
\r
122 if ( queueName.equals(PRIBIT64.toString())) {
\r
127 if ( queueName.equals(BIT64.toString())) {
\r
132 if ( queueName.equals(BIGMEM.toString())) {
\r
137 if ( queueName.equals(BIGINT.toString())) {
\r
142 // such queue appears to be not defined in the system!
\r