From 785c54d40bfafefbcf9ae75316b2c087733a5a43 Mon Sep 17 00:00:00 2001 From: pvtroshin Date: Tue, 28 Jun 2011 16:54:59 +0000 Subject: [PATCH] Stat collector updates to work with JABA 2 input & output files git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4366 e3abac25-378b-4346-85de-24260fe3988d --- .classpath | 2 +- TODO.txt | 14 ++- conf/settings/AAConParameters.xml | 10 +-- .../stat/collector/ExecutionStatCollector.java | 90 +++++++++++--------- website/prog_docs/{AACon_manual.txt => aacon.txt} | 0 5 files changed, 60 insertions(+), 56 deletions(-) rename website/prog_docs/{AACon_manual.txt => aacon.txt} (100%) diff --git a/.classpath b/.classpath index 26035d7..9651a3f 100644 --- a/.classpath +++ b/.classpath @@ -9,9 +9,9 @@ - + diff --git a/TODO.txt b/TODO.txt index 2d86534..6e843bd 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,6 @@ -Help information? -statistics - result files -Check progress tracking on large sequence. ++ Help information? - relative - client to add host and context info ++ statistics - result files ++ Check progress tracking on large sequence. Add more detailed tests for webservices? @@ -19,18 +19,14 @@ add to help text: To disable a web service remove it from WEB-INF/sun-jaxws.xml rename jaba.war to jabaws.war and make sure jabaws context path is used throughout. -Current stat collector has to rely on file dates! -To change this you need -1) Collect all the stats in old format into the DB -2) Update the code to get the date out of the file. -Can be done once JABAWS 1 is replaced with 2. ++ Current stat collector has to rely on file dates! ? Replace conservation.Method with server.ws.Method and try building WS. If this does not work - get rid of Method integrate the above to tweak the size of the local job -Good toString method for Limits (test with command line client -limits) ++ Good toString method for Limits (test with command line client -limits) Document the Limits for presets JABA DOCS diff --git a/conf/settings/AAConParameters.xml b/conf/settings/AAConParameters.xml index 2274cd3..e2d6543 100644 --- a/conf/settings/AAConParameters.xml +++ b/conf/settings/AAConParameters.xml @@ -11,14 +11,14 @@ Negative results first converted to positive by adding a greatest absolute result value. -n - http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt + prog_docs/aacon.txt = Calculation method The method of the calculation to use -m - http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt + prog_docs/aacon.txt SHENKIN KABAT JORES @@ -43,7 +43,7 @@ SMERFS Window Width The width of the window for SMERFS. Optional, defaults to 7 -smerfsWW - http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt + prog_docs/aacon.txt 7 Integer @@ -59,7 +59,7 @@ MAX_SCORE - gives the column the highest score of all the windows it belongs to. Optional defaults to MID_SCORE. -smerfsCS - http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt + prog_docs/aacon.txt MID_SCORE MAX_SCORE MID_SCORE @@ -68,7 +68,7 @@ SMERFS Gap Threshhold a gap percentage cutoff - a float greater than 0 and smaller or equal 1. Optional defaults to 0.1 -smerfsGT - http://www.compbio.dundee.ac.uk/jabaws/prog_docs/aacon.txt + prog_docs/aacon.txt 0.1 Float diff --git a/webservices/compbio/stat/collector/ExecutionStatCollector.java b/webservices/compbio/stat/collector/ExecutionStatCollector.java index ec35a15..f1dd8e4 100644 --- a/webservices/compbio/stat/collector/ExecutionStatCollector.java +++ b/webservices/compbio/stat/collector/ExecutionStatCollector.java @@ -17,6 +17,7 @@ import org.apache.log4j.Logger; import compbio.engine.client.Executable; import compbio.engine.client.PathValidator; +import compbio.engine.client.SkeletalExecutable; import compbio.metadata.JobStatus; import compbio.util.FileUtil; import compbio.ws.client.Services; @@ -102,11 +103,12 @@ public class ExecutionStatCollector implements Runnable { return ((System.currentTimeMillis() - jd.jobdir.lastModified()) / (1000 * 60 * 60)) > timeOutInHours; } - /* Make sure that collectStatistics methods was called prior to calling this! - * TODO consider running collectStatistics from here on the first call - */ + /* + * Make sure that collectStatistics methods was called prior to calling + * this! TODO consider running collectStatistics from here on the first call + */ StatProcessor getStats() { - if(stats.isEmpty()) { + if (stats.isEmpty()) { log.info("Please make sure collectStatistics method was called prior to calling getStats()!"); } return new StatProcessor(stats); @@ -194,13 +196,25 @@ public class ExecutionStatCollector implements Runnable { if (startfile == null) { startfile = files.get(JobStatus.SUBMITTED.toString()); } - if (startfile != null) { + try { + if (startfile != null) { + String start = FileUtil.readFileToString(startfile); + starttime = Long.parseLong(start.trim()); + } + } catch (IOException ignore) { + log.warn( + "IOException while reading STARTED status file! Ignoring...", + ignore); + // fall back + starttime = startfile.lastModified(); + } catch (NumberFormatException ignore) { + log.warn( + "NumberFormatException while reading STARTED status file! Ignoring...", + ignore); + // fall back starttime = startfile.lastModified(); - /* - * String start = FileUtil.readFileToString(startfile); - * starttime = Long.parseLong(start.trim()); - */ } + return starttime; } @@ -223,19 +237,25 @@ public class ExecutionStatCollector implements Runnable { long ftime = UNDEFINED; File finished = files.get(JobStatus.FINISHED.toString()); if (finished != null) { - ftime = finished.lastModified(); - /* - * String start = FileUtil.readFileToString(finished); ftime = - * Long.parseLong(start.trim()); - */ - // System.out.println("f " + ftime); + try { + if (finished != null) { + String start = FileUtil.readFileToString(finished); + ftime = Long.parseLong(start.trim()); + } + } catch (IOException ignore) { + log.warn( + "IOException while reading FINISHED status file! Ignoring...", + ignore); + // fall back + ftime = finished.lastModified(); + } catch (NumberFormatException ignore) { + log.warn( + "NumberFormatException while reading FINISHED status file! Ignoring...", + ignore); + // fall back + ftime = finished.lastModified(); + } } - /* - * } catch (IOException e) { log.log(Level.WARN, - * "Cannot parse finished time: " + e.getMessage(), e); } catch - * (NumberFormatException e) { log.log(Level.WARN, - * "Cannot parse finished time: " + e.getMessage(), e); } - */ return ftime; } @@ -243,22 +263,19 @@ public class ExecutionStatCollector implements Runnable { return Services.getServiceByJobDirectory(jobdir); } - // Mafft, Muscle, Tcoffee, Clustal task:fasta.in result:fasta.out - // Probcons task:fasta.in result:alignment.out - /* - * TODO replace with Universal names for WS! - */ long getResultSize() { Class> name = Services .getRunnerByJobDirectory(jobdir); File f = null; - if (name.getSimpleName().equalsIgnoreCase("Probcons")) { - f = files.get("alignment.out"); - } else if (name.getSimpleName().equalsIgnoreCase("ClustalW")) { - f = files.get("output.txt"); + if (name.getSimpleName().equalsIgnoreCase("IUPred")) { + f = files.get("out.glob"); + if (f == null) + f = files.get("out.short"); + if (f == null) + f = files.get("out.long"); } else { - f = files.get("fasta.out"); + f = files.get(SkeletalExecutable.OUTPUT); } if (f != null) { return f.length(); @@ -266,20 +283,11 @@ public class ExecutionStatCollector implements Runnable { return UNDEFINED; } - /* - * TODO unify input! - */ long getInputSize() { Class> name = Services .getRunnerByJobDirectory(jobdir); - File input = null; - if (name.getSimpleName().equalsIgnoreCase("ClustalW")) { - input = files.get("input.txt"); - } else { - input = files.get("fasta.in"); - } - + File input = files.get(SkeletalExecutable.INPUT); if (input != null) { return input.length(); } diff --git a/website/prog_docs/AACon_manual.txt b/website/prog_docs/aacon.txt similarity index 100% rename from website/prog_docs/AACon_manual.txt rename to website/prog_docs/aacon.txt -- 1.7.10.2