+++ /dev/null
-/* Copyright (c) 2009 Peter Troshin\r
- * \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
- * \r
- * This library is free software; you can redistribute it and/or modify it under the terms of the\r
- * Apache License version 2 as published by the Apache Software Foundation\r
- * \r
- * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
- * License for more details.\r
- * \r
- * A copy of the license is in apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
- * \r
- * Any republication or derived work distributed in source code form\r
- * must include this copyright and license notice.\r
- */\r
-package compbio.engine.cluster.dundee;\r
-import static compbio.engine.cluster.dundee._QueueConstraints.FIRST_MEMORY_LIMIT;\r
-import static compbio.engine.cluster.dundee._QueueConstraints.LONG_TIME_LIMIT;\r
-import static compbio.engine.cluster.dundee._QueueConstraints.MAX_MEMORY_LIMIT;\r
-import static compbio.engine.cluster.dundee._QueueConstraints.SHORT_TIME_LIMIT;\r
-\r
-@Deprecated\r
-public enum _Queue {\r
-\r
- /*\r
- * devel.q 4Gb or 16Gb 8 hour I 64bit-pri.q 4Gb or 16Gb 24 hours B 64bit.q\r
- * 4Gb or 16Gb None B bigint.q 32Gb 8 h I bigmem.q 32Gb None B\r
- */\r
-\r
- /**\r
- * Order of the constraint reflect the priority of the queue\r
- */\r
- DEVEL(FIRST_MEMORY_LIMIT, SHORT_TIME_LIMIT, "devel.q"), PRIBIT64(\r
- FIRST_MEMORY_LIMIT, LONG_TIME_LIMIT, "64bit-pri.q"), BIT64(\r
- FIRST_MEMORY_LIMIT, 0, "64bit.q"), BIGINT(MAX_MEMORY_LIMIT,\r
- SHORT_TIME_LIMIT, "bigint.q"), BIGMEM(MAX_MEMORY_LIMIT, 0,\r
- "bigmem.q");\r
-\r
- int maxMemory;\r
- int maxRuntime;\r
- String qname;\r
- private _Queue(int maxMemory, int maxRuntime, String qname) {\r
- this.maxMemory = maxMemory;\r
- this.maxRuntime = maxRuntime;\r
- this.qname = qname;\r
- }\r
-\r
- // -q 64bit.q -l qname=64bit.q -l h_vmem=8000M -l ram=8000M\r
- @Override\r
- public String toString() {\r
- return qname;\r
- }\r
-\r
- /**\r
- * 0 - unlimited\r
- * \r
- * @return max runtime in hours\r
- */\r
- public int getTimeLimit() {\r
- return this.maxRuntime;\r
- }\r
-\r
- /**\r
- * \r
- * @return true if the queue has time limit, false overwise\r
- */\r
- public boolean hasTimeLimit() {\r
- return this.maxRuntime != 0;\r
- }\r
- /**\r
- * return max memory limit in Mb\r
- * \r
- * @return\r
- */\r
- public int getMemoryLimit() {\r
- return this.maxMemory;\r
- }\r
-\r
- public static _Queue getQueueByMemoryRequirements(int maxMemory) {\r
- if (maxMemory > FIRST_MEMORY_LIMIT) {\r
- return BIGMEM;\r
- } else if (maxMemory < MAX_MEMORY_LIMIT)\r
- return BIT64;\r
- else {\r
- throw new UnsupportedOperationException(\r
- "Cluster does not support tasks requiring more than 30000M of memory");\r
- }\r
- }\r
-\r
- public static _Queue getQueue(int maxMemory, int timeLimitInHours) {\r
- if (timeLimitInHours == 0) {\r
- return getQueueByMemoryRequirements(maxMemory);\r
- } else {\r
- if (timeLimitInHours <= SHORT_TIME_LIMIT) {\r
- if (maxMemory <= FIRST_MEMORY_LIMIT) {\r
- return DEVEL;\r
- } else if (maxMemory <= MAX_MEMORY_LIMIT) {\r
- return BIGINT;\r
- } else {\r
- throw new UnsupportedOperationException(\r
- "Cluster does not support tasks requiring more than 30000M of memory");\r
- }\r
- } else {\r
- // timeLimit > 8\r
- if (timeLimitInHours <= LONG_TIME_LIMIT\r
- && maxMemory <= FIRST_MEMORY_LIMIT) {\r
- return PRIBIT64;\r
- } else if (maxMemory <= MAX_MEMORY_LIMIT) {\r
- return BIGMEM;\r
- } else {\r
- throw new UnsupportedOperationException(\r
- "Cluster does not support tasks requiring more than 30000M of memory");\r
- }\r
- }\r
- }\r
- }\r
-\r
- public _Queue getQueue(String queueName) {\r
- switch (this) {\r
- case DEVEL :\r
- if (queueName.equals(DEVEL.toString())) {\r
- return DEVEL;\r
- }\r
- break;\r
- case PRIBIT64 :\r
- if (queueName.equals(PRIBIT64.toString())) {\r
- return PRIBIT64;\r
- }\r
- break;\r
- case BIT64 :\r
- if (queueName.equals(BIT64.toString())) {\r
- return BIT64;\r
- }\r
- break;\r
- case BIGMEM :\r
- if (queueName.equals(BIGMEM.toString())) {\r
- return BIGMEM;\r
- }\r
- break;\r
- case BIGINT :\r
- if (queueName.equals(BIGINT.toString())) {\r
- return BIGINT;\r
- }\r
- break;\r
- }\r
- // such queue appears to be not defined in the system!\r
- return null;\r
- }\r
-\r
-}\r