Search in sources :

Example 1 with DetailedState

use of cbit.vcell.solver.server.SimulationMessage.DetailedState in project vcell by virtualcell.

the class SimulationJobStatusEvent method fromJsonRep.

public static SimulationJobStatusEvent fromJsonRep(Object eventSource, SimulationJobStatusEventRepresentation eventRep) {
    String simid = Simulation.createSimulationID(new KeyValue(eventRep.jobStatus.simulationKey));
    int jobIndex = eventRep.jobStatus.jobIndex;
    int taskID = eventRep.jobStatus.taskID;
    VCellServerID serverID = VCellServerID.getServerID(eventRep.jobStatus.vcellServerID);
    KeyValue simkey = new KeyValue(eventRep.jobStatus.simulationKey);
    User owner = new User(eventRep.jobStatus.owner_userid, new KeyValue(eventRep.jobStatus.onwer_userkey));
    VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simkey, owner);
    Date submitDate = eventRep.jobStatus.submitDate;
    SchedulerStatus schedulerStatus = null;
    if (eventRep.jobStatus.schedulerStatus != null) {
        schedulerStatus = SchedulerStatus.valueOf(eventRep.jobStatus.schedulerStatus.name());
    }
    HtcJobID htcJobID = null;
    Long htcJobNumber = eventRep.jobStatus.htcJobNumber;
    SimulationJobStatusRepresentation.BatchSystemType htcBatchSystemType = eventRep.jobStatus.htcBatchSystemType;
    if (htcJobNumber != null) {
        htcJobID = new HtcJobID(htcJobNumber.toString(), BatchSystemType.valueOf(htcBatchSystemType.name()));
    }
    SimulationMessage simMessage = null;
    DetailedState detailedState = DetailedState.valueOf(eventRep.jobStatus.detailedState.name());
    String message = eventRep.jobStatus.detailedStateMessage;
    if (detailedState != null) {
        simMessage = SimulationMessage.create(detailedState, message, htcJobID);
    }
    SimulationQueueEntryStatus simQueueStatus = null;
    Date queueDate = eventRep.jobStatus.queueDate;
    Integer queuePriority = eventRep.jobStatus.queuePriority;
    SimulationJobStatusRepresentation.SimulationQueueID queueId2 = eventRep.jobStatus.queueId;
    if (queueDate != null && queuePriority != null) {
        simQueueStatus = new SimulationQueueEntryStatus(queueDate, queuePriority, SimulationQueueID.valueOf(queueId2.name()));
    }
    SimulationExecutionStatus simExeStatus = null;
    Date startDate = eventRep.jobStatus.simexe_startDate;
    String computeHost = eventRep.jobStatus.computeHost;
    Date latestUpdateDate = eventRep.jobStatus.simexe_latestUpdateDate;
    Date endDate = eventRep.jobStatus.simexe_endDate;
    Boolean hasData = eventRep.jobStatus.hasData;
    if (latestUpdateDate != null) {
        simExeStatus = new SimulationExecutionStatus(startDate, computeHost, latestUpdateDate, endDate, hasData, htcJobID);
    }
    SimulationJobStatus jobStatus = new SimulationJobStatus(serverID, vcSimID, jobIndex, submitDate, schedulerStatus, taskID, simMessage, simQueueStatus, simExeStatus);
    Double progress = eventRep.progress;
    Double timepoint = eventRep.timePoint;
    String username = eventRep.username;
    SimulationJobStatusEvent event = new SimulationJobStatusEvent(eventSource, simid, jobStatus, progress, timepoint, username);
    return event;
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) SimulationExecutionStatus(cbit.vcell.server.SimulationExecutionStatus) KeyValue(org.vcell.util.document.KeyValue) User(org.vcell.util.document.User) SchedulerStatus(cbit.vcell.server.SimulationJobStatus.SchedulerStatus) SimulationJobStatusRepresentation(org.vcell.api.common.events.SimulationJobStatusRepresentation) DetailedState(cbit.vcell.solver.server.SimulationMessage.DetailedState) SimulationQueueEntryStatus(cbit.vcell.server.SimulationQueueEntryStatus) Date(java.util.Date) VCellServerID(org.vcell.util.document.VCellServerID) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus) SimulationMessage(cbit.vcell.solver.server.SimulationMessage) HtcJobID(cbit.vcell.server.HtcJobID)

Aggregations

HtcJobID (cbit.vcell.server.HtcJobID)1 SimulationExecutionStatus (cbit.vcell.server.SimulationExecutionStatus)1 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)1 SchedulerStatus (cbit.vcell.server.SimulationJobStatus.SchedulerStatus)1 SimulationQueueEntryStatus (cbit.vcell.server.SimulationQueueEntryStatus)1 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)1 SimulationMessage (cbit.vcell.solver.server.SimulationMessage)1 DetailedState (cbit.vcell.solver.server.SimulationMessage.DetailedState)1 Date (java.util.Date)1 SimulationJobStatusRepresentation (org.vcell.api.common.events.SimulationJobStatusRepresentation)1 KeyValue (org.vcell.util.document.KeyValue)1 User (org.vcell.util.document.User)1 VCellServerID (org.vcell.util.document.VCellServerID)1