Search in sources :

Example 1 with SimulationQueueEntryStatusPersistent

use of cbit.vcell.server.SimulationQueueEntryStatusPersistent in project vcell by virtualcell.

the class SimulationJobTable method getSimulationJobStatus.

/**
 * This method was created in VisualAge.
 * @return VCImage
 * @param rset ResultSet
 * @param log SessionLog
 */
public SimulationJobStatusPersistent getSimulationJobStatus(ResultSet rset) throws SQLException {
    // serverid
    String serID = rset.getString(this.serverID.toString());
    if (rset.wasNull()) {
        serID = null;
    }
    // simRef
    KeyValue parsedSimKey = new KeyValue(rset.getBigDecimal(simRef.toString()));
    // userKey
    KeyValue userKey = new KeyValue(rset.getBigDecimal(SimulationTable.table.ownerRef.toString()));
    // userKey
    String userid = rset.getString(UserTable.table.userid.toString());
    org.vcell.util.document.User owner = new org.vcell.util.document.User(userid, userKey);
    // submitDate
    java.util.Date parsedSubmitDate = rset.getTimestamp(submitDate.toString());
    // taskID
    int parsedTaskID = rset.getInt(taskID.toString());
    // schedulerStatus
    int parsedSchedulerStatusInt = rset.getInt(schedulerStatus.toString());
    SchedulerStatus parsedSchedulerStatus = SchedulerStatus.fromDatabaseNumber(parsedSchedulerStatusInt);
    // statusMsg
    String parsedStatusMsg = TokenMangler.getSQLRestoredString(rset.getString(statusMsg.toString()));
    SimulationMessagePersistent simulationMessage = SimulationMessagePersistent.fromSerialized(parsedSchedulerStatus, parsedStatusMsg);
    // 
    // read queue stuff
    // 
    // queueDate
    java.util.Date parsedQueuedDate = rset.getTimestamp(queueDate.toString());
    // queuePriority
    int parsedQueuePriority = rset.getInt(queuePriority.toString());
    if (rset.wasNull()) {
        parsedQueuePriority = -1;
    }
    // queueID
    int parsedQueueID = rset.getInt(queueID.toString());
    if (rset.wasNull()) {
        parsedQueueID = -1;
    }
    SimulationJobStatusPersistent.SimulationQueueID simulationQueueID = SimulationJobStatusPersistent.SimulationQueueID.fromDatabaseNumber(parsedQueueID);
    SimulationQueueEntryStatusPersistent simQueueEntryStatus = new SimulationQueueEntryStatusPersistent(parsedQueuedDate, parsedQueuePriority, simulationQueueID);
    // 
    // read solver stuff
    // 
    // startDate
    java.util.Date parsedStartDate = rset.getTimestamp(startDate.toString());
    // computeHost
    String parsedComputeHost = rset.getString(computeHost.toString());
    // latestUpdateDate
    java.util.Date parsedLatestUpdateDate = rset.getTimestamp(latestUpdateDate.toString());
    // endDate
    java.util.Date parsedEndDate = rset.getTimestamp(endDate.toString());
    // hasData
    String parsedHasData = rset.getString(hasData.toString());
    HtcJobID parsedHtcJobID = null;
    String htcJobIDString = rset.getString(pbsJobID.toString());
    if (!rset.wasNull() && htcJobIDString != null && htcJobIDString.length() > 0) {
        parsedHtcJobID = SimulationJobTable.fromDatabase(htcJobIDString);
    }
    SimulationExecutionStatusPersistent simExeStatus = new SimulationExecutionStatusPersistent(parsedStartDate, parsedComputeHost, parsedLatestUpdateDate, parsedEndDate, parsedHasData != null, parsedHtcJobID);
    VCSimulationIdentifier parsedVCSimID = new VCSimulationIdentifier(parsedSimKey, owner);
    // jobIndex
    int parsedJobIndex = rset.getInt(jobIndex.toString());
    SimulationJobStatusPersistent simulationJobStatus = new SimulationJobStatusPersistent(VCellServerID.getServerID(serID), parsedVCSimID, parsedJobIndex, parsedSubmitDate, parsedSchedulerStatus, parsedTaskID, simulationMessage, simQueueEntryStatus, simExeStatus);
    // sysDate
    java.util.Date parsedSysDate = rset.getTimestamp(DatabaseConstants.SYSDATE_COLUMN_NAME);
    if (!rset.wasNull()) {
        simulationJobStatus.setTimeDateStamp(parsedSysDate);
    }
    return simulationJobStatus;
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) SchedulerStatus(cbit.vcell.server.SimulationJobStatusPersistent.SchedulerStatus) SimulationQueueEntryStatusPersistent(cbit.vcell.server.SimulationQueueEntryStatusPersistent) SimulationExecutionStatusPersistent(cbit.vcell.server.SimulationExecutionStatusPersistent) SimulationJobStatusPersistent(cbit.vcell.server.SimulationJobStatusPersistent) SimulationMessagePersistent(cbit.vcell.solver.server.SimulationMessagePersistent) HtcJobID(cbit.vcell.server.HtcJobID)

Example 2 with SimulationQueueEntryStatusPersistent

use of cbit.vcell.server.SimulationQueueEntryStatusPersistent 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 3 with SimulationQueueEntryStatusPersistent

use of cbit.vcell.server.SimulationQueueEntryStatusPersistent in project vcell by virtualcell.

the class SimulationJobTable method getSQLValueList.

/**
 * This method was created in VisualAge.
 * @return java.lang.String
 * @param key KeyValue
 * @param modelName java.lang.String
 */
public String getSQLValueList(KeyValue key, SimulationJobStatusPersistent simulationJobStatus) {
    StringBuffer buffer = new StringBuffer();
    buffer.append("(");
    buffer.append(key + ",");
    // simRef
    buffer.append(simulationJobStatus.getVCSimulationIdentifier().getSimulationKey() + ",");
    // submitDate
    if (simulationJobStatus.getSubmitDate() == null) {
        buffer.append("current_timestamp,");
    } else {
        buffer.append(VersionTable.formatDateToOracle(simulationJobStatus.getSubmitDate()) + ",");
    }
    // taskID
    buffer.append(simulationJobStatus.getTaskID() + ",");
    // schedulerStatus
    buffer.append(simulationJobStatus.getSchedulerStatus().getDatabaseNumber() + ",");
    // statusMsg
    String message = simulationJobStatus.getSimulationMessage().toSerialization();
    buffer.append("'" + TokenMangler.getSQLEscapedString(message, 4000) + "',");
    // queue stuff
    SimulationQueueEntryStatusPersistent simQueueEntryStatus = simulationJobStatus.getSimulationQueueEntryStatus();
    // queueDate
    if (simulationJobStatus.getSchedulerStatus().inQueue()) {
        buffer.append("current_timestamp,");
    } else {
        if (simQueueEntryStatus != null && simQueueEntryStatus.getQueueDate() != null) {
            buffer.append(VersionTable.formatDateToOracle(simQueueEntryStatus.getQueueDate()) + ",");
        } else {
            buffer.append("null,");
        }
    }
    if (simQueueEntryStatus == null) {
        buffer.append("null,null,");
    } else {
        // queuePriority
        buffer.append(simQueueEntryStatus.getQueuePriority() + ",");
        // queueID
        buffer.append(simQueueEntryStatus.getQueueID().getDatabaseNumber() + ",");
    }
    // execution stuff
    SimulationExecutionStatusPersistent simExecutionStatus = simulationJobStatus.getSimulationExecutionStatus();
    if (simExecutionStatus == null) {
        buffer.append("null,null,current_timestamp,null,null,");
    } else {
        // startDate
        if (simExecutionStatus.getStartDate() != null) {
            buffer.append(VersionTable.formatDateToOracle(simExecutionStatus.getStartDate()) + ",");
        } else {
            if (simulationJobStatus.getSchedulerStatus() == SchedulerStatus.COMPLETED) {
                buffer.append("current_timestamp,");
            } else {
                buffer.append("null,");
            }
        }
        // computeHost
        if (simExecutionStatus.getComputeHost() != null) {
            buffer.append("'" + simExecutionStatus.getComputeHost().toLowerCase() + "',");
        } else {
            buffer.append("null,");
        }
        // LatestUpdateDate
        buffer.append("current_timestamp,");
        // endDate
        if (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(simExecutionStatus.hasData() ? "'Y'," : "null,");
    }
    buffer.append(simulationJobStatus.getServerID() == null ? "null," : "'" + simulationJobStatus.getServerID() + "',");
    buffer.append(simulationJobStatus.getJobIndex() + ",");
    if (simExecutionStatus != null && simExecutionStatus.getHtcJobID() != null) {
        buffer.append("'" + simExecutionStatus.getHtcJobID().toDatabase() + "'");
    } else {
        buffer.append("null");
    }
    buffer.append(")");
    return buffer.toString();
}
Also used : SimulationQueueEntryStatusPersistent(cbit.vcell.server.SimulationQueueEntryStatusPersistent) SimulationExecutionStatusPersistent(cbit.vcell.server.SimulationExecutionStatusPersistent)

Example 4 with SimulationQueueEntryStatusPersistent

use of cbit.vcell.server.SimulationQueueEntryStatusPersistent 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

SimulationExecutionStatusPersistent (cbit.vcell.server.SimulationExecutionStatusPersistent)4 SimulationQueueEntryStatusPersistent (cbit.vcell.server.SimulationQueueEntryStatusPersistent)4 SimulationJobStatusPersistent (cbit.vcell.server.SimulationJobStatusPersistent)3 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 SimulationMessagePersistent (cbit.vcell.solver.server.SimulationMessagePersistent)2 HtcJobID (cbit.vcell.server.HtcJobID)1 SchedulerStatus (cbit.vcell.server.SimulationJobStatusPersistent.SchedulerStatus)1 Date (java.util.Date)1 KeyValue (org.vcell.util.document.KeyValue)1 VCellServerID (org.vcell.util.document.VCellServerID)1