use of cbit.vcell.server.SimulationJobStatusPersistent in project vcell by virtualcell.
the class SimulationJobTable method getSQLUpdateList.
/**
* This method was created in VisualAge.
* @return java.lang.String
* @param key KeyValue
* @param modelName java.lang.String
*/
public String getSQLUpdateList(SimulationJobStatusPersistent simulationJobStatus) {
StringBuffer buffer = new StringBuffer();
//
// basic info
//
// simRef
buffer.append(simRef + "=" + simulationJobStatus.getVCSimulationIdentifier().getSimulationKey() + ",");
// submiteDate
buffer.append(submitDate + "=" + (simulationJobStatus.getSubmitDate() == null ? "current_timestamp," : VersionTable.formatDateToOracle(simulationJobStatus.getSubmitDate()) + ","));
// taskID
buffer.append(taskID + "=" + simulationJobStatus.getTaskID() + ",");
// schedulerStatus
buffer.append(schedulerStatus + "=" + simulationJobStatus.getSchedulerStatus().getDatabaseNumber() + ",");
// statusMsg
String message = simulationJobStatus.getSimulationMessage().toSerialization();
buffer.append(statusMsg + "='" + TokenMangler.getSQLEscapedString(message, 4000) + "',");
//
// queue info
//
SimulationQueueEntryStatusPersistent simQueueEntryStatus = simulationJobStatus.getSimulationQueueEntryStatus();
// queueDate
buffer.append(queueDate + "=");
if (simQueueEntryStatus != null && simQueueEntryStatus.getQueueDate() != null) {
buffer.append(VersionTable.formatDateToOracle(simQueueEntryStatus.getQueueDate()) + ",");
} else {
if (simulationJobStatus.getSchedulerStatus().inQueue()) {
buffer.append("current_timestamp,");
} else {
buffer.append("null,");
}
}
// queuePriority
buffer.append(queuePriority + "=");
if (simQueueEntryStatus != null) {
buffer.append(simQueueEntryStatus.getQueuePriority() + ",");
} else {
buffer.append("null,");
}
// queueID
buffer.append(queueID + "=");
if (simQueueEntryStatus != null) {
SimulationJobStatusPersistent.SimulationQueueID simQueueID = simQueueEntryStatus.getQueueID();
if (simQueueID != null) {
buffer.append(simQueueEntryStatus.getQueueID().getDatabaseNumber() + ",");
} else {
buffer.append("null,");
}
} else {
buffer.append("null,");
}
//
// execution status
//
SimulationExecutionStatusPersistent simExecutionStatus = simulationJobStatus.getSimulationExecutionStatus();
// startDate
buffer.append(startDate + "=");
if (simExecutionStatus != null && simExecutionStatus.getStartDate() != null) {
buffer.append(VersionTable.formatDateToOracle(simExecutionStatus.getStartDate()) + ",");
} else {
if (simulationJobStatus.getSchedulerStatus().isWaiting()) {
buffer.append("null,");
} else {
buffer.append("current_timestamp,");
}
}
// computeHost
buffer.append(computeHost + "=");
if (simExecutionStatus != null && simExecutionStatus.getComputeHost() != null) {
buffer.append("'" + simExecutionStatus.getComputeHost().toLowerCase() + "',");
} else {
buffer.append("null,");
}
// latestUpdateDate
buffer.append(latestUpdateDate + "=current_timestamp,");
// endDate
buffer.append(endDate + "=");
if (simExecutionStatus != null && simExecutionStatus.getEndDate() != null) {
buffer.append(VersionTable.formatDateToOracle(simExecutionStatus.getEndDate()) + ",");
} else {
if (simulationJobStatus.getSchedulerStatus().isDone()) {
buffer.append("current_timestamp,");
} else {
buffer.append("null,");
}
}
// hasData
buffer.append(hasData + "=");
if (simExecutionStatus != null && simExecutionStatus.hasData()) {
buffer.append("'Y',");
} else {
buffer.append("null,");
}
// serverID
buffer.append(serverID + "=");
if (simulationJobStatus.getServerID() != null) {
buffer.append("'" + simulationJobStatus.getServerID() + "',");
} else {
buffer.append("null,");
}
// jobIndex
buffer.append(jobIndex + "=");
buffer.append(simulationJobStatus.getJobIndex() + ",");
// pbsJobID
buffer.append(pbsJobID + "=");
if (simExecutionStatus != null && simExecutionStatus.getHtcJobID() != null) {
buffer.append("'" + simExecutionStatus.getHtcJobID().toDatabase() + "'");
} else {
buffer.append("null");
}
return buffer.toString();
}
use of cbit.vcell.server.SimulationJobStatusPersistent in project vcell by virtualcell.
the class SimulationDatabaseDirect method getLatestSimulationJobStatus.
@Override
public SimulationJobStatus getLatestSimulationJobStatus(KeyValue simKey, int jobIndex) throws DataAccessException, SQLException {
SimulationJobStatusPersistent[] simJobStatusArray = adminDbTopLevel.getSimulationJobStatusArray(simKey, jobIndex, true);
if (simJobStatusArray.length == 0) {
return null;
}
int latestTaskID = simJobStatusArray[0].getTaskID();
for (SimulationJobStatusPersistent simJobStatus : simJobStatusArray) {
if (latestTaskID < simJobStatus.getTaskID()) {
latestTaskID = simJobStatus.getTaskID();
}
}
return getSimulationJobStatus(simKey, jobIndex, latestTaskID);
}
use of cbit.vcell.server.SimulationJobStatusPersistent in project vcell by virtualcell.
the class SimulationDatabaseDirect method insertSimulationJobStatus.
@Override
public void insertSimulationJobStatus(SimulationJobStatus simulationJobStatus) throws DataAccessException, SQLException {
SimulationJobStatusPersistent simulationJobStatusDb = translateToSimulationJobStatusPersistent(simulationJobStatus);
adminDbTopLevel.insertSimulationJobStatus(simulationJobStatusDb, true);
SimJobStatusKey key = new SimJobStatusKey(simulationJobStatus.getVCSimulationIdentifier().getSimulationKey(), simulationJobStatus.getJobIndex(), simulationJobStatus.getTaskID());
cache.put(key, new SimStatusCacheEntry(simulationJobStatus, null));
}
use of cbit.vcell.server.SimulationJobStatusPersistent in project vcell by virtualcell.
the class SimulationDatabaseDirect method updateSimulationJobStatus.
@Override
public void updateSimulationJobStatus(SimulationJobStatus newSimulationJobStatus, StateInfo stateInfo) throws DataAccessException, UpdateSynchronizationException, SQLException {
SimulationJobStatusPersistent newSimulationJobStatusDb = translateToSimulationJobStatusPersistent(newSimulationJobStatus);
adminDbTopLevel.updateSimulationJobStatus(newSimulationJobStatusDb, true);
SimJobStatusKey key = new SimJobStatusKey(newSimulationJobStatus.getVCSimulationIdentifier().getSimulationKey(), newSimulationJobStatus.getJobIndex(), newSimulationJobStatus.getTaskID());
cache.put(key, new SimStatusCacheEntry(newSimulationJobStatus, stateInfo));
}
use of cbit.vcell.server.SimulationJobStatusPersistent in project vcell by virtualcell.
the class SimulationDatabaseDirect method translateToSimulationJobStatusPersistent.
private SimulationJobStatusPersistent translateToSimulationJobStatusPersistent(SimulationJobStatus simJobStatus) {
VCellServerID serverID = simJobStatus.getServerID();
VCSimulationIdentifier vcSimID = simJobStatus.getVCSimulationIdentifier();
int jobIndex = simJobStatus.getJobIndex();
Date submitDate = simJobStatus.getSubmitDate();
SimulationJobStatusPersistent.SchedulerStatus schedulerStatus = SimulationJobStatusPersistent.SchedulerStatus.valueOf(simJobStatus.getSchedulerStatus().name());
int taskID = simJobStatus.getTaskID();
SimulationMessagePersistent simMessage = SimulationMessagePersistent.fromSerializedMessage(simJobStatus.getSimulationMessage().toSerialization());
Date queueDate = simJobStatus.getSimulationQueueEntryStatus().getQueueDate();
int queuePriority = simJobStatus.getSimulationQueueEntryStatus().getQueuePriority();
SimulationJobStatusPersistent.SimulationQueueID queueId = SimulationJobStatusPersistent.SimulationQueueID.valueOf(simJobStatus.getSimulationQueueEntryStatus().getQueueID().name());
SimulationQueueEntryStatusPersistent simQueueStatus = new SimulationQueueEntryStatusPersistent(queueDate, queuePriority, queueId);
SimulationExecutionStatusPersistent simExecStatus = new SimulationExecutionStatusPersistent(simJobStatus.getSimulationExecutionStatus().getStartDate(), simJobStatus.getSimulationExecutionStatus().getComputeHost(), simJobStatus.getSimulationExecutionStatus().getLatestUpdateDate(), simJobStatus.getSimulationExecutionStatus().getEndDate(), simJobStatus.getSimulationExecutionStatus().hasData(), simJobStatus.getSimulationExecutionStatus().getHtcJobID());
SimulationJobStatusPersistent simJobStatusPersistent = new SimulationJobStatusPersistent(serverID, vcSimID, jobIndex, submitDate, schedulerStatus, taskID, simMessage, simQueueStatus, simExecStatus);
return simJobStatusPersistent;
}
Aggregations