Search in sources :

Example 1 with SimulationTaskID

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

the class SimulationControllerImpl method getSolverStatus.

/**
 * This method was created by a SmartGuide.
 * @return java.lang.String
 * @exception java.rmi.RemoteException The exception description.
 */
public SolverStatus getSolverStatus(SimulationInfo simulationInfo, int jobIndex, int taskID) throws PermissionException, DataAccessException {
    SimulationTaskID simTaskInfo = new SimulationTaskID(simulationInfo, jobIndex, taskID);
    LocalSolverController solverController = solverControllerHash.get(simTaskInfo);
    if (solverController == null) {
        return new SolverStatus(SolverStatus.SOLVER_READY, SimulationMessage.MESSAGE_SOLVER_READY);
    }
    return solverController.getSolverStatus();
}
Also used : LocalSolverController(cbit.vcell.solvers.LocalSolverController) SimulationTaskID(cbit.vcell.server.SimulationTaskID) SolverStatus(cbit.vcell.solver.server.SolverStatus)

Example 2 with SimulationTaskID

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

the class SimulationControllerImpl method onServiceControlTopic_StopSimulation.

private void onServiceControlTopic_StopSimulation(VCMessage message) {
    KeyValue simKey = new KeyValue(String.valueOf(message.getLongProperty(MessageConstants.SIMKEY_PROPERTY)));
    int jobIndex = message.getIntProperty(MessageConstants.JOBINDEX_PROPERTY);
    int taskID = message.getIntProperty(MessageConstants.TASKID_PROPERTY);
    try {
        SimulationTaskID simTaskInfo = new SimulationTaskID(simKey, jobIndex, taskID);
        LocalSolverController solverController = solverControllerHash.get(simTaskInfo);
        if (solverController != null) {
            // can only start after updating the database is done
            solverController.stopSimulationJob();
        }
    } catch (Exception e) {
        lg.error(e.getMessage(), e);
        VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, localVCellConnection.getUserLoginInfo().getUser());
        SimulationJobStatus newJobStatus = new SimulationJobStatus(VCellServerID.getSystemServerID(), vcSimID, jobIndex, null, SchedulerStatus.FAILED, taskID, SimulationMessage.jobFailed(e.getMessage()), null, null);
        SimulationJobStatusEvent event = new SimulationJobStatusEvent(this, Simulation.createSimulationID(simKey), newJobStatus, null, null, vcSimID.getOwner().getName());
        fireSimulationJobStatusEvent(event);
    }
}
Also used : LocalSolverController(cbit.vcell.solvers.LocalSolverController) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) SimulationTaskID(cbit.vcell.server.SimulationTaskID) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus) SimulationJobStatusEvent(cbit.rmi.event.SimulationJobStatusEvent) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) SQLException(java.sql.SQLException) VCMessagingException(cbit.vcell.message.VCMessagingException) SolverException(cbit.vcell.solver.SolverException) AuthenticationException(org.vcell.util.AuthenticationException) DataAccessException(org.vcell.util.DataAccessException) JMSException(javax.jms.JMSException) FileNotFoundException(java.io.FileNotFoundException) RemoteException(java.rmi.RemoteException) ConfigurationException(org.vcell.util.ConfigurationException)

Example 3 with SimulationTaskID

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

the class SimulationControllerImpl method getOrCreateSolverController.

/**
 * This method was created by a SmartGuide.
 * @throws SolverException
 * @throws DataAccessException
 * @throws ConfigurationException
 * @exception java.rmi.RemoteException The exception description.
 * @throws JMSException
 * @throws AuthenticationException
 * @throws SQLException
 * @throws FileNotFoundException
 */
LocalSolverController getOrCreateSolverController(SimulationTask simTask) throws FileNotFoundException, ConfigurationException, DataAccessException, AuthenticationException, SQLException, SolverException {
    Simulation simulation = simTask.getSimulation();
    VCSimulationIdentifier vcSimID = simulation.getSimulationInfo().getAuthoritativeVCSimulationIdentifier();
    if (vcSimID == null) {
        throw new IllegalArgumentException("cannot run an unsaved simulation");
    }
    if (!simulation.getVersion().getOwner().equals(localVCellConnection.getUserLoginInfo().getUser())) {
        throw new PermissionException("insufficient privilege: startSimulation()");
    }
    SimulationTaskID simTaskInfo = new SimulationTaskID(simTask);
    LocalSolverController solverController = solverControllerHash.get(simTaskInfo);
    if (solverController == null) {
        solverController = createNewSolverController(simTask);
        solverControllerHash.put(simTaskInfo, solverController);
    }
    return solverController;
}
Also used : PermissionException(org.vcell.util.PermissionException) LocalSolverController(cbit.vcell.solvers.LocalSolverController) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) Simulation(cbit.vcell.solver.Simulation) SimulationTaskID(cbit.vcell.server.SimulationTaskID)

Aggregations

SimulationTaskID (cbit.vcell.server.SimulationTaskID)3 LocalSolverController (cbit.vcell.solvers.LocalSolverController)3 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 PermissionException (org.vcell.util.PermissionException)2 SimulationJobStatusEvent (cbit.rmi.event.SimulationJobStatusEvent)1 VCMessagingException (cbit.vcell.message.VCMessagingException)1 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)1 Simulation (cbit.vcell.solver.Simulation)1 SolverException (cbit.vcell.solver.SolverException)1 SolverStatus (cbit.vcell.solver.server.SolverStatus)1 FileNotFoundException (java.io.FileNotFoundException)1 RemoteException (java.rmi.RemoteException)1 SQLException (java.sql.SQLException)1 JMSException (javax.jms.JMSException)1 AuthenticationException (org.vcell.util.AuthenticationException)1 ConfigurationException (org.vcell.util.ConfigurationException)1 DataAccessException (org.vcell.util.DataAccessException)1 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)1 KeyValue (org.vcell.util.document.KeyValue)1