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.FIRST_MEMORY_LIMIT;
\r
20 import static compbio.engine.cluster.dundee._QueueConstraints.LONG_TIME_LIMIT;
\r
21 import static compbio.engine.cluster.dundee._QueueConstraints.MAX_MEMORY_LIMIT;
\r
22 import static compbio.engine.cluster.dundee._QueueConstraints.SHORT_TIME_LIMIT;
\r
25 public enum _Queue {
\r
28 * devel.q 4Gb or 16Gb 8 hour I 64bit-pri.q 4Gb or 16Gb 24 hours B 64bit.q
\r
29 * 4Gb or 16Gb None B bigint.q 32Gb 8 h I bigmem.q 32Gb None B
\r
33 * Order of the constraint reflect the priority of the queue
\r
35 DEVEL(FIRST_MEMORY_LIMIT, SHORT_TIME_LIMIT, "devel.q"), PRIBIT64(
\r
36 FIRST_MEMORY_LIMIT, LONG_TIME_LIMIT, "64bit-pri.q"), BIT64(
\r
37 FIRST_MEMORY_LIMIT, 0, "64bit.q"), BIGINT(MAX_MEMORY_LIMIT,
\r
38 SHORT_TIME_LIMIT, "bigint.q"), BIGMEM(MAX_MEMORY_LIMIT, 0,
\r
44 private _Queue(int maxMemory, int maxRuntime, String qname) {
\r
45 this.maxMemory = maxMemory;
\r
46 this.maxRuntime = maxRuntime;
\r
50 // -q 64bit.q -l qname=64bit.q -l h_vmem=8000M -l ram=8000M
\r
52 public String toString() {
\r
59 * @return max runtime in hours
\r
61 public int getTimeLimit() {
\r
62 return this.maxRuntime;
\r
67 * @return true if the queue has time limit, false overwise
\r
69 public boolean hasTimeLimit() {
\r
70 return this.maxRuntime != 0;
\r
73 * return max memory limit in Mb
\r
77 public int getMemoryLimit() {
\r
78 return this.maxMemory;
\r
81 public static _Queue getQueueByMemoryRequirements(int maxMemory) {
\r
82 if (maxMemory > FIRST_MEMORY_LIMIT) {
\r
84 } else if (maxMemory < MAX_MEMORY_LIMIT)
\r
87 throw new UnsupportedOperationException(
\r
88 "Cluster does not support tasks requiring more than 30000M of memory");
\r
92 public static _Queue getQueue(int maxMemory, int timeLimitInHours) {
\r
93 if (timeLimitInHours == 0) {
\r
94 return getQueueByMemoryRequirements(maxMemory);
\r
96 if (timeLimitInHours <= SHORT_TIME_LIMIT) {
\r
97 if (maxMemory <= FIRST_MEMORY_LIMIT) {
\r
99 } else if (maxMemory <= MAX_MEMORY_LIMIT) {
\r
102 throw new UnsupportedOperationException(
\r
103 "Cluster does not support tasks requiring more than 30000M of memory");
\r
107 if (timeLimitInHours <= LONG_TIME_LIMIT
\r
108 && maxMemory <= FIRST_MEMORY_LIMIT) {
\r
110 } else if (maxMemory <= MAX_MEMORY_LIMIT) {
\r
113 throw new UnsupportedOperationException(
\r
114 "Cluster does not support tasks requiring more than 30000M of memory");
\r
120 public _Queue getQueue(String queueName) {
\r
123 if (queueName.equals(DEVEL.toString())) {
\r
128 if (queueName.equals(PRIBIT64.toString())) {
\r
133 if (queueName.equals(BIT64.toString())) {
\r
138 if (queueName.equals(BIGMEM.toString())) {
\r
143 if (queueName.equals(BIGINT.toString())) {
\r
148 // such queue appears to be not defined in the system!
\r