From: Sasha Sherstnev Date: Tue, 17 Jun 2014 06:57:43 +0000 (+0100) Subject: New code update X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4825c5456a465ac3e13d0131f8e87f584b9871fa;p=jabaws.git New code update --- diff --git a/build.xml b/build.xml index 6c7b389..fe7b271 100644 --- a/build.xml +++ b/build.xml @@ -83,7 +83,10 @@ + + + @@ -343,14 +346,17 @@ Jar file: StatUpdater jar + + + + - - + @@ -359,6 +365,7 @@ + diff --git a/log/log4j.properties.updater b/log/log4j.properties.updater new file mode 100644 index 0000000..e6f4a06 --- /dev/null +++ b/log/log4j.properties.updater @@ -0,0 +1,20 @@ + +## CHANGE THIS (The root directory where to store all the log files) +#logDir = . + +## Uncomment to enable JWS2 activity logging to standard out (to the console if available) +## for possible log levels please refer to Log4j documentation http://logging.apache.org/log4j/1.2/manual.html +## Valid log levels are: +## TRACE - log everything from below including very detailed messages (useful for debugging only) +## DEBUG - log everything from below including some minor events (useful for debugging only) +## INFO - log everything from below including some information messages +## WARN - log error and warnings +## ERROR - log errors and fatal events only +## FATAL - log fatal events only + +################################################################################################################################## +log4j.rootLogger=DEBUG +log4j.appender.R=org.apache.log4j.FileAppender +log4j.appender.R.File=StatDBupdater.log +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%m%n %d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %3x - diff --git a/webservices/compbio/stat/collector/ExecutionStatUpdater.java b/webservices/compbio/stat/collector/ExecutionStatUpdater.java index f26ecc3..a5d89d1 100644 --- a/webservices/compbio/stat/collector/ExecutionStatUpdater.java +++ b/webservices/compbio/stat/collector/ExecutionStatUpdater.java @@ -139,9 +139,9 @@ public class ExecutionStatUpdater { return new StatProcessor(stats); } - void writeStatToDB() throws SQLException { + void writeStatToDB(String dbname) throws SQLException { Set rjobs = new HashSet(stats); - StatDB statdb = new StatDB(); + StatDB statdb = new StatDB(dbname); log.debug("Removing records that has already been recorded"); statdb.removeRecordedJobs(rjobs); log.debug("New records left: " + rjobs.size()); @@ -155,18 +155,29 @@ public class ExecutionStatUpdater { public static void main(String[] args) throws IOException, SQLException, ParseException { mainJCommander jct = new mainJCommander(); new JCommander(jct, args); - String WorkingDir = jct.workingdir; - String dbname = jct.dbname; - Date ST = shortDF.parse(jct.starttime); - Date ET = shortDF.parse(jct.endtime); - long StartTime = 0; - if (null != ST) { - StartTime = ST.getTime(); - } + String WorkingDir = "jobsout"; + String DBname = "ExecutionStatistic"; + + long StartTime = 0L; Date currDate = new Date(); long EndTime = currDate.getTime(); - if (null != ET) { - EndTime = ET.getTime(); + if (null != jct.starttime) { + Date ST = shortDF.parse(jct.starttime); + if (null != ST) { + StartTime = ST.getTime(); + } + } + if (null != jct.endtime) { + Date ET = shortDF.parse(jct.endtime); + if (null != ET) { + EndTime = ET.getTime(); + } + } + if (null != jct.dbname) { + DBname = jct.dbname; + } + if (null != jct.workingdir) { + WorkingDir = jct.workingdir; } System.out.println("Start time: " + jct.starttime + " = " + StartTime); @@ -174,7 +185,7 @@ public class ExecutionStatUpdater { ExecutionStatUpdater esu = new ExecutionStatUpdater(WorkingDir, 1); esu.collectStatistics(StartTime, EndTime); - esu.writeStatToDB(); + esu.writeStatToDB(DBname); } static FileFilter directories = new FileFilter() { @@ -189,12 +200,14 @@ public class ExecutionStatUpdater { // clear stats array; stats.clear(); File[] dirs = workingDirectory.listFiles(directories); + log.debug("Start time = " + StartTime + ", end time = " + EndTime); for (File dir : dirs) { // skip work directory with test inputs and out of ordered time // range log.debug("check directory: " + dir.getName() + "..."); if (InputFilter.accept(new File(dir.getPath() + File.separator + SkeletalExecutable.INPUT)) && StartTime < dir.lastModified() && dir.lastModified() < EndTime) { + log.debug(", ACCEPTED"); JobDirectory jd = new JobDirectory(dir); JobStat jstat = jd.getJobStat(); // Do not record stats on the job that has not completed yet @@ -204,9 +217,11 @@ public class ExecutionStatUpdater { log.debug("Skipping the job: " + jstat + " as it has not completed yet"); } } else { + log.debug(", REJECTED"); log.trace("training input: " + dir.getName() + File.separator + SkeletalExecutable.INPUT); } } + log.debug("Statistics collected!"); } }