From: Sasha Date: Wed, 24 Apr 2013 16:09:22 +0000 (+0100) Subject: cleat stats array and simplify internal structure X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1771320b59430a5f09d5fbae60df3aecce7312e7;p=jabaws.git cleat stats array and simplify internal structure --- diff --git a/webservices/compbio/stat/collector/ExecutionStatCollector.java b/webservices/compbio/stat/collector/ExecutionStatCollector.java index c64a5b8..62f39c9 100644 --- a/webservices/compbio/stat/collector/ExecutionStatCollector.java +++ b/webservices/compbio/stat/collector/ExecutionStatCollector.java @@ -72,8 +72,7 @@ public class ExecutionStatCollector implements Runnable { static final int UNDEFINED = -1; - private static final Logger log = Logger - .getLogger(ExecutionStatCollector.class); + private static final Logger log = Logger.getLogger(ExecutionStatCollector.class); static SimpleDateFormat DF = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); @@ -95,15 +94,13 @@ public class ExecutionStatCollector implements Runnable { log.info("Starting stat collector for directory: " + workDirectory); log.info("Maximum allowed runtime(h): " + timeOutInHours); if (!PathValidator.isValidDirectory(workDirectory)) { - throw new IllegalArgumentException("workDirectory '" - + workDirectory + "' does not exist!"); + throw new IllegalArgumentException("workDirectory '" + workDirectory + "' does not exist!"); } this.workDirectory = new File(workDirectory); stats = new ArrayList(); if (timeOutInHours <= 0) { throw new IllegalArgumentException( - "Timeout value must be greater than 0! Given value: " - + timeOutInHours); + "Timeout value must be greater than 0! Given value: " + timeOutInHours); } this.timeOutInHours = timeOutInHours; } @@ -348,23 +345,26 @@ public class ExecutionStatCollector implements Runnable { // TODO test! void collectStatistics() { + // clear stats array; + stats.clear(); File[] files = workDirectory.listFiles(directories); for (File file : files) { - if (!InputFilter.accept(new File(file.getPath() + File.separator - + SkeletalExecutable.INPUT))) { - // skip work directory with test input - continue; - } - JobDirectory jd = new JobDirectory(file); - JobStat jstat = jd.getJobStat(); - // Do not record stats on the job that has not completed yet - if (hasCompleted(jd)) { - stats.add(jstat); + // skip work directory with test input + if (InputFilter.accept(new File(file.getPath() + File.separator + SkeletalExecutable.INPUT))) { + JobDirectory jd = new JobDirectory(file); + JobStat jstat = jd.getJobStat(); + // Do not record stats on the job that has not completed yet + if (hasCompleted(jd)) { + stats.add(jstat); + System.out.println("added: id = " + jd); + } else { + log.debug("Skipping the job: " + jstat); + log.debug("As it has not completed yet"); + } + // System.out.println(jd.getJobStat().getJobReportTabulated()); } else { - log.debug("Skipping the job: " + jstat); - log.debug("As it has not completed yet"); + log.trace("training input: " + file.getPath() + File.separator + SkeletalExecutable.INPUT); } - // System.out.println(jd.getJobStat().getJobReportTabulated()); } } @Override