--- /dev/null
+package compbio.cassandra;
+
+import com.datastax.driver.core.Session;
+
+public interface CassandraReader {
+
+ /*
+ * Defines a source file with metainformation of Jpred Jobs
+ **/
+ void setSession (Session s);
+
+ /*
+ * Makes real parsing of the source file
+ **/
+ /*void getResults();*/
+}
--- /dev/null
+package compbio.cassandra.readers;
+
+
+import java.util.Calendar;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.log4j.Logger;
+
+import com.datastax.driver.core.Row;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.PreparedStatement;
+import com.datastax.driver.core.BoundStatement;
+
+import compbio.cassandra.CassandraReader;
+import compbio.cassandra.Pair;
+import compbio.engine.ProteoCachePropertyHelperManager;
+import compbio.util.PropertyHelper;
+
+public class CassandraReaderExecutionTime implements CassandraReader {
+ private Session session;
+
+ public static String CASSANDRA_HOSTNAME = "localhost";
+ public static boolean READ_WEB_JPRED = false;
+ public static boolean READ_LOCALFILE_JPRED = false;
+
+ public void setSession(Session s) {
+ assert s != null;
+ session = s;
+ }
+
+ private void setConditions() {
+
+ }
+
+ public boolean JobisNotInsterted(String jobid) {
+ ResultSet results1 = session.execute("SELECT * FROM ProteinLog WHERE JobID = '" + jobid + "';");
+ if (results1.isExhausted()) {
+ return true;
+ }
+ return false;
+ }
+
+ public boolean JobisNotArchived(String jobid) {
+ ResultSet results1 = session.execute("SELECT * FROM JpredArchive WHERE JobID = '" + jobid + "';");
+ if (results1.isExhausted()) {
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * getting data from the db
+ */
+ public List<Pair<String, String>> ReadProteinDataTable() {
+ final long startTime = System.currentTimeMillis();
+ String com = "SELECT DataBegin,DataEnd FROM ProteinKeyspace.ProteinLog;";
+ System.out.println("Command: " + com);
+ ResultSet results = session.execute(com);
+ final long queryTime = System.currentTimeMillis();
+ List<Row> rows = results.all();
+ System.out.println("Query time is " + (queryTime - startTime) + " msec");
+
+ List<Pair<String, String>> res = new ArrayList<Pair<String, String>>();
+ int c = 0;
+ for (Row r : rows) {
+ Pair<String, String> pair = new Pair<String, String>(r.getString("DataBegin"), r.getString("DataEnd"));
+ res.add(pair);
+ ++c;
+ }
+ final long endTime = System.currentTimeMillis();
+ System.out.println(c + " rows analysed, execution time is " + (endTime - startTime) + " msec");
+ return res;
+ }
+
+ /*
+ * getting earlest date of jobs from the db
+ */
+ public long getEarliestDateInDB() {
+ final long startTime = System.currentTimeMillis();
+ String com = "SELECT jobtime FROM ProteinKeyspace.ProteinData;";
+ System.out.println("Command: " + com);
+ ResultSet results = session.execute(com);
+ final long queryTime = System.currentTimeMillis();
+ System.out.println("Query time is " + (queryTime - startTime) + " msec");
+
+ Calendar cal = Calendar.getInstance();
+ long res = cal.getTimeInMillis();
+ int c = 0;
+ while (!results.isExhausted()) {
+ Row r = results.one();
+ long d1 = r.getLong("jobtime");
+ if (res > d1) {
+ res = d1;
+ }
+ ++c;
+ }
+ final long endTime = System.currentTimeMillis();
+ System.out.println(c + " rows analysed, execution time is " + (endTime - startTime) + " msec");
+ return res;
+ }
+
+}
+++ /dev/null
-<%@page import="java.util.ArrayList"%>
-<%@ page trimDirectiveWhitespaces="true"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
-<%@ taglib uri="http://displaytag.sf.net" prefix="dt"%>
-<c:choose>
- <c:when test="${flag == 'AllDate'}">
- <h3>Time execution for the whole period</h3>
- </c:when>
- <c:otherwise>
- <h3>Time execution for the interval: ${data1} - ${data2}</h3>
- </c:otherwise>
-</c:choose>
-<h3>Time execution: ${timeExecution} ms</h3>
-
-<c:set var="sum" value="0" />
-<c:forEach items="${result}" var="res" varStatus="loop">
- <c:choose>
- <c:when test="${loop.last}">
- <c:forEach items="${res.timeTotalExec}" var="total">
- <c:set var="sum" value="${sum + total}" />
- </c:forEach>
- </c:when>
- </c:choose>
-</c:forEach>
-
-<h3>Total number of jobs: ${sum}</h3>
-
-<table border="1" style="border-collapse: collapse; white-space: nowrap">
- <thead>
- <tr>
- <th style="text-align: centre; width: 150px">Date</th>
- <th style="text-align: centre; width: 150px">less then 30 s</th>
- <th style="text-align: centre; width: 150px">30 s - 60 s</th>
- <th style="text-align: centre; width: 150px">1 min - 2 min</th>
- <th style="text-align: centre; width: 150px">2 min - 10 min</th>
- <th style="text-align: centre; width: 150px">more then 10 min</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="${result}" var="res" varStatus="loop">
- <c:choose>
- <c:when test="${loop.last}">
- <tr style="font-weight: bolder;">
- <td>Total:</td>
- <c:forEach items="${res.timeTotalExec}" var="total">
- <td style="text-align: right">${total}</td>
- </c:forEach>
- </tr>
- </c:when>
- </c:choose>
- </c:forEach>
-
- <c:forEach items="${result}" var="res" varStatus="loop">
- <c:choose>
- <c:when test="${not loop.last}">
- <tr>
- <td>${res.date}</td>
- <c:forEach items="${res.timeRez}" var="time">
- <td style="text-align: right">${time}</td>
- </c:forEach>
- </tr>
- </c:when>
- </c:choose>
- </c:forEach>
- </tbody>
-</table>
+++ /dev/null
-<%@page import="java.util.ArrayList"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
-<%@ taglib uri="http://displaytag.sf.net" prefix="dt"%>
-<c:choose>
- <c:when test="${flag == 'AllDate'}">
- <h3>Jobs statistics for the whole period</h3>
- </c:when>
- <c:otherwise>
- <h3>
- Jobs statistics for the Period:
- <c:out value="${data1}" />
- to
- <c:out value="${data2}" />
- </h3>
- </c:otherwise>
-</c:choose>
-<h3>Time execution: ${timeExecution} ms</h3>
-
-<c:set var="sum" value="0" />
-<c:forEach items="${result}" var="res">
- <c:set var="tot" value="${res.total}" />
- <c:set var="sum" value="${sum + tot}" />
-</c:forEach>
-
-
-<table border="1" style="border-collapse: collapse; white-space: nowrap">
- <thead>
- <tr>
- <th rowspan="2" style="text-align: centre">Date</th>
- <th colspan="4" style="text-align: centre">Number of Proteins</th>
- </tr>
- <tr>
- <th style="text-align: centre">Total</th>
- <th style="text-align: centre">Failed</th>
- <th style="text-align: centre">Cancelled</th>
- <th style="text-align: centre">Abandoned</th>
- </tr>
- </thead>
- <tbody>
-
- <tr style="font-weight: bolder;">
- <td>Total:</td>
- <td style="text-align: right">${sum}</td>
- <td style="text-align: right">0</td>
- <td style="text-align: right">0</td>
- <td style="text-align: right">0</td>
- </tr>
-
- <c:set var="sum" value="0" />
- <c:forEach items="${result}" var="res">
- <tr>
- <td>${res.date}</td>
- <td style="text-align: right"><c:out value="${res.total}" /></td>
- <td style="text-align: right">0</td>
- <td style="text-align: right">0</td>
- <td style="text-align: right">0</td>
- </tr>
- </c:forEach>
-
- </tbody>
-</table>
\ No newline at end of file