+ "predictions map<ascii,ascii>, ArchiveLink varchar, LOG varchar, ProgramName ascii, ProgramVersion ascii, PRIMARY KEY(JobID));");
session.execute("CREATE TABLE IF NOT EXISTS JobDateInfo "
- + "(jobday bigint, Total bigint, TotalOK bigint, TotalStopped bigint, TotalError bigint, TotalTimeOut bigint, Program varchar, Version varchar, PRIMARY KEY(jobday));");
+ + "(jobday bigint, TotalOK bigint, TotalStopped bigint, TotalError bigint, TotalTimeOut bigint, PRIMARY KEY(jobday));");
session.execute("CREATE TABLE IF NOT EXISTS Programs "
+ "(Program varchar, Version varchar, Description varchar, weblink varchar, PRIMARY KEY(Program,Version));");
}
/*
- * fill new table
- */
- public void FillNewTable() {
- final long StartTime = System.currentTimeMillis();
- long erldate = CassandraNativeConnector.getEarliestDateInDB();
- Calendar runnicCal = Calendar.getInstance();
- runnicCal.setTime(new Date(erldate));
- Calendar endcal = Calendar.getInstance();
- long endTime = endcal.getTime().getTime();
- for (Date date = runnicCal.getTime(); date.getTime() < endTime; runnicCal.add(Calendar.DATE, 1), date = runnicCal.getTime()) {
- try {
- ResultSet results = session.execute("SELECT * FROM ProteinData WHERE jobtime = " + date.getTime() + ";");
- session.execute("INSERT INTO JobDateInfo " + "(jobday, Total)" + " VALUES (" + date.getTime() + "," + results.all().size()
- + ");");
- } catch (QueryExecutionException e) {
- e.printStackTrace();
- }
- }
- System.out.println("Table JobDateInfo filled: total time is " + (System.currentTimeMillis() - StartTime) + " msec");
- }
-
- /*
* fill a table with the database global parameters
*/
public void FillMainDBParameters() {
return 0;
}
Row row = results.one();
- long njobs = row.getLong("Total") - 1;
if (status.equals("OK")) {
long njobsOK = row.getLong("TotalOK") - 1;
String com4 = "DELETE FROM ProteinRow WHERE JobID = '" + jobid + "';";
String com5 = "DELETE FROM ProteinData WHERE JobID = '" + jobid + "' AND jobtime = " + date + ";";
System.out.println("Command: " + com5);
CassandraQuery(com5);
- UpdateJobDateInfo(date, "TotalOK", njobsOK, njobs);
+ UpdateJobDateInfo(date, "TotalOK", njobsOK);
} else {
String com6 = "DELETE FROM FailLog WHERE JobID = '" + jobid + "' AND jobtime = " + date + ";";
System.out.println("Command: " + com6);
CassandraQuery(com6);
if (status.equals("STOPPED")) {
long njobsStopped = row.getLong("TotalStopped") - 1;
- UpdateJobDateInfo(date, "TotalStopped", njobsStopped, njobs);
+ UpdateJobDateInfo(date, "TotalStopped", njobsStopped);
} else if (status.equals("ERROR")) {
long njobsError = row.getLong("TotalError") - 1;
- UpdateJobDateInfo(date, "TotalError", njobsError, njobs);
+ UpdateJobDateInfo(date, "TotalError", njobsError);
} else if (status.equals("TIMEDOUT")) {
long njobsTimeOut = row.getLong("TotalTimeOut") - 1;
- UpdateJobDateInfo(date, "TotalTimeOut", njobsTimeOut, njobs);
+ UpdateJobDateInfo(date, "TotalTimeOut", njobsTimeOut);
}
}
System.out.println("Job " + jobid + " removed...");
* @return nothing
*
*/
- private void UpdateJobDateInfo(long date, String ColumnName, long totalcol, long total) {
- String com = "UPDATE JobDateInfo SET " + ColumnName + " = " + totalcol + ", Total = " + total + " WHERE jobday = " + date + ";";
- System.out.println("Command: " + com);
+ private void UpdateJobDateInfo(long date, String ColumnName, long totalcol) {
+ String com = "UPDATE JobDateInfo SET " + ColumnName + " = " + totalcol + " WHERE jobday = " + date + ";";
CassandraQuery(com);
}
njobsStop += r.getLong("TotalStopped");
njobsTimeOut += r.getLong("TotalTimeOut");
}
- String com = "INSERT INTO JobDateInfo " + "(jobday, Total, TotalOK, TotalStopped, TotalError, TotalTimeOut)" + " VALUES ("
- + job.getStartingDate() + "," + njobsTotal + "," + njobsOk + "," + njobsStop + "," + njobsError + "," + njobsTimeOut
- + ");";
+ String com = "INSERT INTO JobDateInfo " + "(jobday, TotalOK, TotalStopped, TotalError, TotalTimeOut)" + " VALUES ("
+ + job.getStartingDate() + "," + njobsOk + "," + njobsStop + "," + njobsError + "," + njobsTimeOut + ");";
if (null == execute(com)) {
System.out.println("CassandraWriter.FormQueryTables: couldn't insert into JobDateInfo");
// return 0;
return null;
if (results.isExhausted())
continue;
- Row therow = results.one();
- Total res = new Total(therow.getLong("Total"), therow.getLong("TotalOK"), therow.getLong("TotalStopped"),
- therow.getLong("TotalError"), therow.getLong("TotalTimeOut"));
+ Row row = results.one();
+ long nOK = row.getLong("TotalOK");
+ long nStopped = row.getLong("TotalStopped");
+ long nError = row.getLong("TotalError");
+ long nTimeOut = row.getLong("TotalTimeOut");
+ Total res = new Total(nOK + nStopped + nError + nTimeOut, nOK, nStopped, nError, nTimeOut);
if (!results.isExhausted()) {
Date dat = new Date(date.getTime());
log.warn("CassandraReader.ReadDateTable: date row for " + dat.toString() + " (" + date.getTime() + ") duplicated ");