Stat collector updates to work with JABA 2 input & output files
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 28 Jun 2011 16:54:59 +0000 (16:54 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Tue, 28 Jun 2011 16:54:59 +0000 (16:54 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4366 e3abac25-378b-4346-85de-24260fe3988d

.classpath
TODO.txt
conf/settings/AAConParameters.xml
webservices/compbio/stat/collector/ExecutionStatCollector.java
website/prog_docs/aacon.txt [moved from website/prog_docs/AACon_manual.txt with 100% similarity]

index 26035d7..9651a3f 100644 (file)
@@ -9,9 +9,9 @@
        <classpathentry kind="lib" path="testsrc/lib/testng-5.10-jdk15.jar"/>\r
        <classpathentry kind="lib" path="lib/servlet-api.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/drmaa.jar"/>\r
-       <classpathentry kind="lib" path="WEB-INF/lib/derby.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/log4j-1.2.15.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/compbio-annotations-1.0.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/compbio-util-1.4.jar"/>\r
+       <classpathentry kind="lib" path="WEB-INF/lib/derby.jar"/>\r
        <classpathentry kind="output" path="WEB-INF/classes"/>\r
 </classpath>\r
index 2d86534..6e843bd 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,6 +1,6 @@
-Help information?\r
-statistics - result files \r
-Check progress tracking on large sequence. \r
++ Help information? - relative - client to add host and context info\r
++ statistics - result files \r
++ Check progress tracking on large sequence. \r
 \r
 Add more detailed tests for webservices? \r
 \r
@@ -19,18 +19,14 @@ add to help text: To disable a web service remove it from WEB-INF/sun-jaxws.xml
 \r
 rename jaba.war to jabaws.war and make sure jabaws context path is used throughout. \r
 \r
-Current stat collector has to rely on file dates! \r
-To change this you need \r
-1) Collect all the stats in old format into the DB\r
-2) Update the code to get the date out of the file.  \r
-Can be done once JABAWS 1 is replaced with 2. \r
++ Current stat collector has to rely on file dates! \r
 \r
 \r
 ? Replace conservation.Method with server.ws.Method and try building WS. If this does not work - get rid of Method\r
 \r
 integrate the above to tweak the size of the local job\r
 \r
-Good toString method for Limits (test with command line client -limits)\r
++ Good toString method for Limits (test with command line client -limits)\r
 Document the Limits for presets\r
 JABA DOCS\r
 \r
index 2274cd3..e2d6543 100644 (file)
                Negative results first converted to positive by adding a greatest absolute \r
                result value.</description>\r
                <optionNames>-n</optionNames>\r
-               <furtherDetails>http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt</furtherDetails>\r
+               <furtherDetails>prog_docs/aacon.txt</furtherDetails>\r
        </options>\r
        <prmSeparator>=</prmSeparator>\r
        <parameters>\r
                <name>Calculation method</name>\r
                <description>The method of the calculation to use</description>\r
                <optionNames>-m</optionNames>\r
-               <furtherDetails>http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt</furtherDetails>\r
+               <furtherDetails>prog_docs/aacon.txt</furtherDetails>\r
                <defaultValue>SHENKIN</defaultValue>\r
         <possibleValues>KABAT</possibleValues>\r
         <possibleValues>JORES</possibleValues>\r
@@ -43,7 +43,7 @@
                <name>SMERFS Window Width</name>\r
                <description>The width of the window for SMERFS. Optional, defaults to 7</description>\r
                <optionNames>-smerfsWW</optionNames>\r
-               <furtherDetails>http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt</furtherDetails>\r
+               <furtherDetails>prog_docs/aacon.txt</furtherDetails>\r
                <defaultValue>7</defaultValue>\r
                <validValue>\r
                <type>Integer</type>\r
@@ -59,7 +59,7 @@
                MAX_SCORE - gives the column the highest score of all the windows it \r
                belongs to. Optional defaults to MID_SCORE. </description>\r
                <optionNames>-smerfsCS</optionNames>\r
-               <furtherDetails>http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt</furtherDetails>\r
+               <furtherDetails>prog_docs/aacon.txt</furtherDetails>\r
                <defaultValue>MID_SCORE</defaultValue>\r
                <possibleValues>MAX_SCORE</possibleValues>\r
         <possibleValues>MID_SCORE</possibleValues>\r
@@ -68,7 +68,7 @@
                <name>SMERFS Gap Threshhold</name>\r
                <description>a gap percentage cutoff - a float greater than 0 and smaller or equal 1. Optional defaults to 0.1</description>\r
                <optionNames>-smerfsGT</optionNames>\r
-               <furtherDetails>http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt</furtherDetails>\r
+               <furtherDetails>prog_docs/aacon.txt</furtherDetails>\r
                <defaultValue>0.1</defaultValue>\r
                <validValue>\r
                <type>Float</type>\r
index ec35a15..f1dd8e4 100644 (file)
@@ -17,6 +17,7 @@ import org.apache.log4j.Logger;
 \r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PathValidator;\r
+import compbio.engine.client.SkeletalExecutable;\r
 import compbio.metadata.JobStatus;\r
 import compbio.util.FileUtil;\r
 import compbio.ws.client.Services;\r
@@ -102,11 +103,12 @@ public class ExecutionStatCollector implements Runnable {
                return ((System.currentTimeMillis() - jd.jobdir.lastModified()) / (1000 * 60 * 60)) > timeOutInHours;\r
        }\r
 \r
-   /* Make sure that collectStatistics methods was called prior to calling this! \r
-       * TODO consider running collectStatistics from here on the first call \r
-       */\r
+       /*\r
+        * Make sure that collectStatistics methods was called prior to calling\r
+        * this! TODO consider running collectStatistics from here on the first call\r
+        */\r
        StatProcessor getStats() {\r
-               if(stats.isEmpty()) {\r
+               if (stats.isEmpty()) {\r
                        log.info("Please make sure collectStatistics method was called prior to calling getStats()!");\r
                }\r
                return new StatProcessor(stats);\r
@@ -194,13 +196,25 @@ public class ExecutionStatCollector implements Runnable {
                        if (startfile == null) {\r
                                startfile = files.get(JobStatus.SUBMITTED.toString());\r
                        }\r
-                       if (startfile != null) {\r
+                       try {\r
+                               if (startfile != null) {\r
+                                       String start = FileUtil.readFileToString(startfile);\r
+                                       starttime = Long.parseLong(start.trim());\r
+                               }\r
+                       } catch (IOException ignore) {\r
+                               log.warn(\r
+                                               "IOException while reading STARTED status file! Ignoring...",\r
+                                               ignore);\r
+                               // fall back\r
+                               starttime = startfile.lastModified();\r
+                       } catch (NumberFormatException ignore) {\r
+                               log.warn(\r
+                                               "NumberFormatException while reading STARTED status file! Ignoring...",\r
+                                               ignore);\r
+                               // fall back\r
                                starttime = startfile.lastModified();\r
-                               /*\r
-                                * String start = FileUtil.readFileToString(startfile);\r
-                                * starttime = Long.parseLong(start.trim());\r
-                                */\r
                        }\r
+\r
                        return starttime;\r
                }\r
 \r
@@ -223,19 +237,25 @@ public class ExecutionStatCollector implements Runnable {
                        long ftime = UNDEFINED;\r
                        File finished = files.get(JobStatus.FINISHED.toString());\r
                        if (finished != null) {\r
-                               ftime = finished.lastModified();\r
-                               /*\r
-                                * String start = FileUtil.readFileToString(finished); ftime =\r
-                                * Long.parseLong(start.trim());\r
-                                */\r
-                               // System.out.println("f " + ftime);\r
+                               try {\r
+                                       if (finished != null) {\r
+                                               String start = FileUtil.readFileToString(finished);\r
+                                               ftime = Long.parseLong(start.trim());\r
+                                       }\r
+                               } catch (IOException ignore) {\r
+                                       log.warn(\r
+                                                       "IOException while reading FINISHED status file! Ignoring...",\r
+                                                       ignore);\r
+                                       // fall back\r
+                                       ftime = finished.lastModified();\r
+                               } catch (NumberFormatException ignore) {\r
+                                       log.warn(\r
+                                                       "NumberFormatException while reading FINISHED status file! Ignoring...",\r
+                                                       ignore);\r
+                                       // fall back\r
+                                       ftime = finished.lastModified();\r
+                               }\r
                        }\r
-                       /*\r
-                        * } catch (IOException e) { log.log(Level.WARN,\r
-                        * "Cannot parse finished time: " + e.getMessage(), e); } catch\r
-                        * (NumberFormatException e) { log.log(Level.WARN,\r
-                        * "Cannot parse finished time: " + e.getMessage(), e); }\r
-                        */\r
                        return ftime;\r
                }\r
 \r
@@ -243,22 +263,19 @@ public class ExecutionStatCollector implements Runnable {
                        return Services.getServiceByJobDirectory(jobdir);\r
                }\r
 \r
-               // Mafft, Muscle, Tcoffee, Clustal task:fasta.in result:fasta.out\r
-               // Probcons task:fasta.in result:alignment.out\r
-               /*\r
-                * TODO replace with Universal names for WS!\r
-                */\r
                long getResultSize() {\r
                        Class<? extends Executable<?>> name = Services\r
                                        .getRunnerByJobDirectory(jobdir);\r
 \r
                        File f = null;\r
-                       if (name.getSimpleName().equalsIgnoreCase("Probcons")) {\r
-                               f = files.get("alignment.out");\r
-                       } else if (name.getSimpleName().equalsIgnoreCase("ClustalW")) {\r
-                               f = files.get("output.txt");\r
+                       if (name.getSimpleName().equalsIgnoreCase("IUPred")) {\r
+                               f = files.get("out.glob");\r
+                               if (f == null)\r
+                                       f = files.get("out.short");\r
+                               if (f == null)\r
+                                       f = files.get("out.long");\r
                        } else {\r
-                               f = files.get("fasta.out");\r
+                               f = files.get(SkeletalExecutable.OUTPUT);\r
                        }\r
                        if (f != null) {\r
                                return f.length();\r
@@ -266,20 +283,11 @@ public class ExecutionStatCollector implements Runnable {
                        return UNDEFINED;\r
                }\r
 \r
-               /*\r
-                * TODO unify input!\r
-                */\r
                long getInputSize() {\r
                        Class<? extends Executable<?>> name = Services\r
                                        .getRunnerByJobDirectory(jobdir);\r
 \r
-                       File input = null;\r
-                       if (name.getSimpleName().equalsIgnoreCase("ClustalW")) {\r
-                               input = files.get("input.txt");\r
-                       } else {\r
-                               input = files.get("fasta.in");\r
-                       }\r
-\r
+                       File input = files.get(SkeletalExecutable.INPUT);\r
                        if (input != null) {\r
                                return input.length();\r
                        }\r