Get rind of NativeClusterJob interface as pretty much every jobs best to use some...
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 12:06:02 +0000 (12:06 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 21 Jun 2011 12:06:02 +0000 (12:06 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4294 e3abac25-378b-4346-85de-24260fe3988d

conf/Executable.properties
engine/compbio/engine/client/ClusterNativeSpecExecutable.java [deleted file]
engine/compbio/engine/client/ConfExecutable.java
engine/compbio/engine/client/Executable.java
engine/compbio/engine/client/SkeletalExecutable.java
engine/compbio/engine/cluster/drmaa/JobRunner.java
runner/compbio/runner/_SkeletalCommandBuilder.java
runner/compbio/runner/_impl/NetNglyc.java
runner/compbio/runner/msa/Mafft.java
runner/compbio/runner/msa/Tcoffee.java

index 667875e..2c82b95 100644 (file)
@@ -36,7 +36,9 @@ mafft.--aamatrix.path=binaries/matrices
 mafft.presets.file=conf/settings/MafftPresets.xml\r
 mafft.parameters.file=conf/settings/MafftParameters.xml\r
 mafft.limits.file=conf/settings/MafftLimits.xml\r
-mafft.cluster.settings=-l h_cpu=24:00:00 -l h_vmem=6000M -l ram=6000M\r
+mafft.cluster.cpunum=4\r
+mafft.cluster.settings=-q 64bit-pri.q -pe smp 4 -l h_cpu=24:00:00 -l h_vmem=1700M -l ram=1700M\r
+\r
 \r
 ### Tcoffee configuration ###\r
 local.tcoffee.bin=binaries/src/tcoffee/t_coffee_source/t_coffee\r
diff --git a/engine/compbio/engine/client/ClusterNativeSpecExecutable.java b/engine/compbio/engine/client/ClusterNativeSpecExecutable.java
deleted file mode 100644 (file)
index da3939d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* 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
-\r
-package compbio.engine.client;\r
-\r
-public interface ClusterNativeSpecExecutable<T> extends Executable<T> {\r
-\r
-       // void setNativeSpecs(String nativeSpecs);\r
-\r
-       String getNativeSpecs();\r
-}\r
index 9477ecf..23d0793 100644 (file)
@@ -373,4 +373,9 @@ public class ConfExecutable<T> implements ConfiguredExecutable<T> {
                value += exec.toString();\r
                return value;\r
        }\r
+\r
+       @Override\r
+       public String getClusterJobSettings() {\r
+               return exec.getClusterJobSettings();\r
+       }\r
 }\r
index b36bc57..5eec9c8 100644 (file)
@@ -65,4 +65,6 @@ public interface Executable<T> {
 \r
        LimitsManager<T> getLimits();\r
 \r
+       String getClusterJobSettings();\r
+\r
 }\r
index f974302..369f8e7 100644 (file)
@@ -261,7 +261,8 @@ public abstract class SkeletalExecutable<T> implements Executable<T> {
                return code;\r
        }\r
 \r
-       public String getClusterSettings() {\r
+       @Override\r
+       public String getClusterJobSettings() {\r
                String settings = ph.getProperty(getType().getSimpleName()\r
                                .toLowerCase() + ".cluster.settings");\r
                return settings == null ? "" : settings;\r
index e7ec791..a3f002a 100644 (file)
@@ -34,7 +34,7 @@ import compbio.engine.Cleaner;
 import compbio.engine.ClusterJobId;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.SyncExecutor;\r
-import compbio.engine.client.ClusterNativeSpecExecutable;\r
+\r
 import compbio.engine.client.ConfiguredExecutable;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PathValidator;\r
@@ -108,9 +108,8 @@ public class JobRunner implements SyncExecutor {
                         * If executable require special cluster configuration parameters to\r
                         * be set e.g. queue, ram, time etc\r
                         */\r
-                       if (confExec.getExecutable() instanceof ClusterNativeSpecExecutable<?>) {\r
-                               setNativeSpecs(confExec.getExecutable());\r
-                       }\r
+                       setNativeSpecs(confExec.getExecutable());\r
+\r
 \r
                        log.trace("using arguments: " + jobtempl.getArgs());\r
                        this.confExecutable = confExec;\r
@@ -161,9 +160,11 @@ public class JobRunner implements SyncExecutor {
        }\r
 \r
        void setNativeSpecs(Executable<?> executable) throws DrmaaException {\r
-               jobtempl\r
-                               .setNativeSpecification(((ClusterNativeSpecExecutable<?>) executable)\r
-                                               .getNativeSpecs());\r
+               String nativeSpecs = executable.getClusterJobSettings(); \r
+               if(!compbio.util.Util.isEmpty(nativeSpecs)) {\r
+                       log.debug("Using cluster job settings: " + nativeSpecs);\r
+                       jobtempl.setNativeSpecification(nativeSpecs);\r
+               }\r
        }\r
 \r
        void setEmail(String email) {\r
index cb50504..2c3adac 100644 (file)
@@ -109,5 +109,11 @@ public abstract class _SkeletalCommandBuilder implements
                // TODO Auto-generated method stub\r
                return null;\r
        }\r
+       \r
+       @Override\r
+       public String getClusterJobSettings() {\r
+               // TODO Auto-generated method stub\r
+               return null; \r
+       }\r
 \r
 }\r
index 4d30683..503aa38 100644 (file)
@@ -109,4 +109,9 @@ public class NetNglyc implements Executable<NetNglyc> {
                // TODO Auto-generated method stub\r
                return null;\r
        }\r
+       @Override\r
+       public String getClusterJobSettings() {\r
+               // TODO Auto-generated method stub\r
+               return null; \r
+       }\r
 }\r
index 508d5f7..dbe49fe 100644 (file)
@@ -27,15 +27,36 @@ import org.apache.log4j.Logger;
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.UnknownFileFormatException;\r
+\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
+/**\r
+ * \r
+ * @author pvtroshin\r
+ *\r
+ */\r
 public class Mafft extends SkeletalExecutable<Mafft>\r
                implements\r
                        PipedExecutable<Mafft> {\r
-\r
+       /*\r
+        * TODO get rid of piping: Mafft now supports --out option for output file. \r
+     * TODO enable multithreading support\r
+        */\r
+       \r
+       /**\r
+        * Number of cores to use, not used if "mafft.cluster.cpunum" property \r
+        * is not defined and in case of local execution \r
+        */\r
+       private int ncoreNumber = 0;\r
+       \r
+       /*\r
+        * Number of cores parameter name\r
+        */\r
+       private final static String ncorePrm = "--thread";\r
+       \r
        private static Logger log = Logger.getLogger(Mafft.class);\r
 \r
        private static String autoOption = "--auto";\r
@@ -88,6 +109,21 @@ public class Mafft extends SkeletalExecutable<Mafft>
                return this;\r
        }\r
 \r
+\r
+       public void setNCore(int ncoreNumber) {\r
+               if (ncoreNumber < 1 || ncoreNumber > 100) {\r
+                       throw new IndexOutOfBoundsException(\r
+                                       "Number of cores must be within 1 and 100 ");\r
+               }\r
+               this.ncoreNumber = ncoreNumber;\r
+               cbuilder.setParam(ncorePrm, Integer.toString(getNCore()));\r
+       }\r
+\r
+       int getNCore() {\r
+               return ncoreNumber;\r
+       }\r
+       \r
+       \r
        @SuppressWarnings("unchecked")\r
        @Override\r
        public Class<Mafft> getType() {\r
index 98b2313..d6dd3fe 100644 (file)
@@ -27,7 +27,6 @@ import org.apache.log4j.Logger;
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.UnknownFileFormatException;\r
-import compbio.engine.client.ClusterNativeSpecExecutable;\r
 import compbio.engine.client.CommandBuilder;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
@@ -38,9 +37,7 @@ import compbio.runner.Util;
 import compbio.util.PropertyHelper;\r
 \r
 public class Tcoffee extends SkeletalExecutable<Tcoffee>\r
-               implements\r
-                       PipedExecutable<Tcoffee>,\r
-                       ClusterNativeSpecExecutable<Tcoffee> {\r
+               implements PipedExecutable<Tcoffee> {\r
 \r
        private static Logger log = Logger.getLogger(Tcoffee.class);\r
 \r
@@ -131,15 +128,11 @@ public class Tcoffee extends SkeletalExecutable<Tcoffee>
                        int cpunum = SkeletalExecutable.getClusterCpuNum(getType());\r
                        if (cpunum != 0) {\r
                                setNCore(cpunum);\r
-                       }\r
+                       } \r
                }\r
                return super.getParameters(provider);\r
        }\r
 \r
-       @Override\r
-       public String getNativeSpecs() {\r
-               return getClusterSettings();\r
-       }\r
 \r
        @SuppressWarnings("unchecked")\r
        @Override\r