Search in sources :

Example 11 with SimulationJobStatusPersistent

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();
}
Also used : SimulationQueueEntryStatusPersistent(cbit.vcell.server.SimulationQueueEntryStatusPersistent) SimulationExecutionStatusPersistent(cbit.vcell.server.SimulationExecutionStatusPersistent) SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent)

Example 12 with SimulationJobStatusPersistent

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);
}
Also used : SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent)

Example 13 with SimulationJobStatusPersistent

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));
}
Also used : SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent)

Example 14 with SimulationJobStatusPersistent

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));
}
Also used : SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent)

Example 15 with SimulationJobStatusPersistent

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;
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) VCellServerID(org.vcell.util.document.VCellServerID) SimulationQueueEntryStatusPersistent(cbit.vcell.server.SimulationQueueEntryStatusPersistent) SimulationExecutionStatusPersistent(cbit.vcell.server.SimulationExecutionStatusPersistent) SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent) Date(java.util.Date) SimulationMessagePersistent(cbit.vcell.solver.server.SimulationMessagePersistent)

Aggregations

SimulationJobStatusPersistent (cbit.vcell.server.SimulationJobStatusPersistent)23 ResultSet (java.sql.ResultSet)8 Statement (java.sql.Statement)8 ArrayList (java.util.ArrayList)8 Connection (java.sql.Connection)5 SimulationStatusPersistent (cbit.vcell.server.SimulationStatusPersistent)4 SimulationExecutionStatusPersistent (cbit.vcell.server.SimulationExecutionStatusPersistent)3 SimulationQueueEntryStatusPersistent (cbit.vcell.server.SimulationQueueEntryStatusPersistent)3 SQLException (java.sql.SQLException)3 Date (java.util.Date)3 DataAccessException (org.vcell.util.DataAccessException)3 User (org.vcell.util.document.User)3 SimpleJobStatusPersistent (cbit.vcell.server.SimpleJobStatusPersistent)2 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)2 Simulation (cbit.vcell.solver.Simulation)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 SimulationMessagePersistent (cbit.vcell.solver.server.SimulationMessagePersistent)2 FileNotFoundException (java.io.FileNotFoundException)2 BigString (org.vcell.util.BigString)2 KeyValue (org.vcell.util.document.KeyValue)2