/* Copyright (c) 2011 Peter Troshin * * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 * * This library is free software; you can redistribute it and/or modify it under the terms of the * Apache License version 2 as published by the Apache Software Foundation * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache * License for more details. * * A copy of the license is in apache_license.txt. It is also available here: * @see: http://www.apache.org/licenses/LICENSE-2.0.txt * * Any republication or derived work distributed in source code form * must include this copyright and license notice. */ package compbio.runner; import java.net.UnknownServiceException; import compbio.engine.cluster.dundee._Queue; @Deprecated public class _NativeSpecHelper { int maxCalculationTime; int requiredMemory; String queue; public _NativeSpecHelper(int requiredMemory) { this(requiredMemory, 0); } public _NativeSpecHelper(int requiredMemory, int maxCalculationTime) { this.requiredMemory = requiredMemory; this.maxCalculationTime = maxCalculationTime; } public void setRequiredMemory(int memory) { this.requiredMemory = memory; } int getRequiredMemory() { return requiredMemory; } public void setQueue(String queue) { this.queue = queue; } public String getQueue() { return queue; } // -q 64bit.q -l qname=64bit.q -l h_vmem=8000M -l ram=8000M public String getNativeSpec() throws UnknownServiceException { if (queue == null) { queue = getApproprieteQueue().toString(); } else { // check whether chosen queue suits for memory and runtime settings _Queue knownQueue = _Queue.BIGINT.getQueue(queue); if (knownQueue == null) { throw new UnknownServiceException("Queue " + queue + " is not regestered in the system! "); } if (this.requiredMemory <= knownQueue.getMemoryLimit()) { throw new UnknownServiceException("Queue " + queue + " has a memory limit of " + knownQueue.getMemoryLimit() + "M - which is smaller than requested!"); } if (knownQueue.hasTimeLimit() && this.maxCalculationTime <= knownQueue.getTimeLimit()) { throw new UnknownServiceException("Queue " + queue + " has a time limit of " + knownQueue.getTimeLimit() + "hours - which is smaller than requested!"); } } return "-q " + queue.toString() + "-l qname=" + queue.toString() + ", h_vmem=" + requiredMemory + "M,ram=" + requiredMemory + "M"; } public _Queue getApproprieteQueue() { return _Queue.getQueue(requiredMemory, maxCalculationTime); } }