#################################################################################
# Jpred sources
# real Jpred web-server
-cassandra.jpred.web.update=false
+cassandra.jpred.web.update=true
cassandra.jpred.web.inidelay=0
cassandra.jpred.web.updaterate=30
*/
public static long getEarliestDateInDB() {
String com = "SELECT * FROM MainParameters WHERE Name = 'EarliestJobDate';";
- System.out.println("Command: " + com);
ResultSet results = session.execute(com);
if (!results.isExhausted()) {
package compbio.cassandra.readers;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
+import compbio.beans.DateBean;
import compbio.beans.ExecutionTimeBean;
-import compbio.beans.Total;
import compbio.beans.TotalExecutionTime;
-import compbio.beans.TotalJobsStatisticBean;
-import compbio.cassandra.DataBase;
import compbio.cassandra.DateFormatter;
import compbio.cassandra.Pair;
}
query.setWholeTotal(wholeTotal);
return query;
-
}
+
+ /**
+ * query: jobs and sequence at a date with current execution time interval
+ *
+ * @param day
+ * the date in long format
+ * @param date
+ * the date in String format
+ *
+ * @param interval
+ * buttom and top bounds of the interval Pair<buttom, top>
+ * @return DateBean to the controller JobController
+ **/
+ public DateBean readJobByDay(long day, String date, Pair<Integer,Integer> interval) {
+ DateBean res = new DateBean(date);
+ ResultSet results = CassandraQuery("SELECT * FROM ProteinData WHERE jobtime = " + day + ";");
+ if (results == null || results.isExhausted())
+ return null;
+ List<Row> rows = results.all();
+ for (Row r : rows) {
+ if (interval.getElement0() <= r.getInt("ExecTime")/1000 && r.getInt("ExecTime")/1000 < interval.getElement1())
+ res.setJobidAndSeq(r.getString("JobID"), r.getString("Protein"));
+
+ }
+ return res;
+ }
+
}
--- /dev/null
+package compbio.engine;
+
+import compbio.cassandra.Pair;
+
+
+/**
+ * List of all possible execution time intervals for statistics
+ *
+ */
+public enum ExecutionInterval {
+ ZERO_THIRTY_SEC, THIRTY_SIXTY_SEC, ONE_TWO_MIN, TWO_TEN_MIN, MORE_THEN_TEN_MIN;
+
+ public static ExecutionInterval getExecutionInterval(String interval) {
+ interval = interval.trim().toLowerCase();
+ for (ExecutionInterval execInterval : ExecutionInterval.values()) {
+ if (execInterval.toString().equalsIgnoreCase(interval)) {
+ return execInterval;
+ }
+ }
+ return null;
+ }
+
+ public static Pair<Integer, Integer> getBoundsInterval(String interval) {
+ ExecutionInterval execInterval = getExecutionInterval(interval);
+ if (execInterval != null)
+ switch (execInterval) {
+ case ZERO_THIRTY_SEC:
+ return Pair.createPair(0, 30);
+ case THIRTY_SIXTY_SEC:
+ return Pair.createPair(30, 60);
+ case ONE_TWO_MIN:
+ return Pair.createPair(60, 120);
+ case TWO_TEN_MIN:
+ return Pair.createPair(120, 600);
+ case MORE_THEN_TEN_MIN:
+ return Pair.createPair(120, Integer.MAX_VALUE);
+ default:
+ return null;
+ }
+ return null;
+ }
+
+
+}
thetime = formaterDDMMYY.parse(realdate).getTime();
}
- if (null == JobStatus.getJobStatus(status)) {
+ if (null == JobStatus.getJobStatus(status))
return "support/Notimplemented";
- }
+
DailyStatisticsReader reader = new DailyStatisticsReader();
// IMPORTANT: input should be suppied in the format: DD/MM/YYYY
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.springframework.web.bind.annotation.RequestParam;
import compbio.statistic.CassandraRequester;
+import compbio.beans.DateBean;
import compbio.beans.ExecutionTimeBean;
import compbio.beans.Total;
import compbio.beans.TotalExecutionTime;
import compbio.cassandra.DataBase;
import compbio.cassandra.DateFormatter;
import compbio.cassandra.readers.CassandraReader;
+import compbio.cassandra.readers.DailyStatisticsReader;
import compbio.cassandra.readers.ExecutionTimeReader;
import compbio.cassandra.readers.JobReader;
+import compbio.engine.ExecutionInterval;
+import compbio.engine.JobStatus;
import compbio.engine.archive.ArchivedJob;
/**
model.put("timeExecution", (endTime - startTime));
return "/reports/TimeExecution";
}
+
+ /**
+ * form a report page for job statistics for one day only.
+ *
+ * @param model
+ * MVC model object
+ * @param date
+ * date for the report
+ * @param status
+ *
+ * @return link to the report JSP page
+ */
+ @RequestMapping(value = "/stat/jobsoneday/executionTime", method = RequestMethod.GET)
+ public String findJobsInOneDay(@RequestParam("date") String date, @RequestParam("interval") String interval, Map<String, Object> model)
+ throws ParseException {
+ model.put("username", getPrincipalName());
+ final long startTime = System.currentTimeMillis();
+
+ String realdate;
+ long thetime = 0;
+ try {
+ thetime = formaterYYMMDD.parse(date).getTime();
+ if (thetime < 0) {
+ realdate = date;
+ } else {
+ realdate = formaterDDMMYY.format(new Date(thetime));
+ }
+ } catch (ParseException e) {
+ realdate = date;
+ thetime = formaterDDMMYY.parse(realdate).getTime();
+ }
+
+ if (null == ExecutionInterval.getExecutionInterval(interval))
+ return "support/Notimplemented";
+
+
+ ExecutionTimeReader reader = new ExecutionTimeReader();
+ // IMPORTANT: input should be suppied in the format: DD/MM/YYYY
+ DateBean r = reader.readJobByDay(thetime, realdate, ExecutionInterval.getBoundsInterval(interval));
+ model.put("results", r);
+ if (r != null)
+ model.put("njobs", r.getJobidAndSeq().size());
+ model.put("date", realdate);
+ model.put("status", interval);
+ final long endTime = System.currentTimeMillis();
+ model.put("timeExecution", (endTime - startTime));
+ return "reports/JobStatisticsOneDay";
+ }
/**
* form a query page for a job. The servlet should no be visible to users at
<body>
<div class="container">
<jsp:include page="../fragments/mainmenu.jsp" />
+ <spring:url value="/stat/jobsoneday/executionTime" var="oneday_query" />
<spring:url value="/stat/exectime/results?date1=${date1}&date2=${date2}&option=${option}" var="the_query" />
<!-- reload and CSV buttons -->
<td style="text-align: center">${res.key}</td>
<c:set var="value" value="${res.value}"/>
<td style="text-align: right">${value.total}</td>
- <td style="text-align: right">${value.total0_30s}</td>
- <td style="text-align: right">${value.total30_60s}</td>
- <td style="text-align: right">${value.total1_2m}</td>
- <td style="text-align: right">${value.total2_10m}</td>
- <td style="text-align: right">${value.total10m}</td>
+ <td style="text-align: right">
+ <c:choose>
+ <c:when test="${value.total0_30s == 0}">0</c:when>
+ <c:otherwise><a href="${oneday_query}?date=${res.key}&interval=ZERO_THIRTY_SEC">${value.total0_30s}</a></c:otherwise>
+ </c:choose>
+ </td>
+ <td style="text-align: right">
+ <c:choose>
+ <c:when test="${value.total0_30s == 0}">0</c:when>
+ <c:otherwise><a href="${oneday_query}?date=${res.key}&interval=THIRTY_SIXTY_SEC">${value.total30_60s}</a></c:otherwise>
+ </c:choose>
+ </td>
+ <td style="text-align: right">
+ <c:choose>
+ <c:when test="${value.total0_30s == 0}">0</c:when>
+ <c:otherwise><a href="${oneday_query}?date=${res.key}&interval=ONE_TWO_MIN">${value.total1_2m}</a></c:otherwise>
+ </c:choose>
+ </td>
+ <td style="text-align: right">
+ <c:choose>
+ <c:when test="${value.total0_30s == 0}">0</c:when>
+ <c:otherwise><a href="${oneday_query}?date=${res.key}&interval=TWO_TEN_MIN">${value.total2_10m}</a></c:otherwise>
+ </c:choose>
+ </td>
+ <td style="text-align: right">
+ <c:choose>
+ <c:when test="${value.total0_30s == 0}">0</c:when>
+ <c:otherwise><a href="${oneday_query}?date=${res.key}&interval=MORE_THEN_TEN_MIN">${value.total10m}</a></c:otherwise>
+ </c:choose>
+ </td>
</tr>
</c:forEach>
</tbody>