Search in sources :

Example 1 with LocalSolverController

use of cbit.vcell.solvers.LocalSolverController 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 LocalSolverController

use of cbit.vcell.solvers.LocalSolverController in project vcell by virtualcell.

the class SimulationControllerImpl method onSimJobQueue_SimulationTask.

private void onSimJobQueue_SimulationTask(VCMessage vcMessage) {
    SimulationTask simTask = null;
    try {
        SimulationTaskMessage simTaskMessage = new SimulationTaskMessage(vcMessage);
        simTask = simTaskMessage.getSimulationTask();
        LocalSolverController solverController = getOrCreateSolverController(simTask);
        // can only start after updating the database is done
        solverController.startSimulationJob();
    } catch (Exception e) {
        lg.error(e.getMessage(), e);
        KeyValue simKey = simTask.getSimKey();
        VCSimulationIdentifier vcSimID = simTask.getSimulationJob().getVCDataIdentifier().getVcSimID();
        int jobIndex = simTask.getSimulationJob().getJobIndex();
        int taskID = simTask.getTaskID();
        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) SimulationTask(cbit.vcell.messaging.server.SimulationTask) KeyValue(org.vcell.util.document.KeyValue) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus) SimulationJobStatusEvent(cbit.rmi.event.SimulationJobStatusEvent) SimulationTaskMessage(cbit.vcell.message.messages.SimulationTaskMessage) 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 LocalSolverController

use of cbit.vcell.solvers.LocalSolverController in project vcell by virtualcell.

the class SimulationControllerImpl method createNewSolverController.

/**
 * Insert the method's description here.
 * Creation date: (6/28/01 1:19:54 PM)
 * @return cbit.vcell.solvers.SolverController
 * @param simulation cbit.vcell.solver.Simulation
 * @throws RemoteException
 * @throws JMSException
 * @throws AuthenticationException
 * @throws DataAccessException
 * @throws SQLException
 * @throws FileNotFoundException
 * @throws SolverException
 * @throws ConfigurationException
 */
private LocalSolverController createNewSolverController(SimulationTask simTask) throws FileNotFoundException, DataAccessException, AuthenticationException, SQLException, ConfigurationException, SolverException {
    // 
    // either no appropriate slave server or THIS IS A SLAVE SERVER (can't pass the buck).
    // 
    LocalSolverController localSolverController = new LocalSolverController(localVCellConnection, simTask, getUserSimulationDirectory(PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty)));
    localSolverController.addWorkerEventListener(this);
    if (lg.isTraceEnabled())
        lg.trace("returning local SolverController for " + simTask.getSimulationJobID());
    return localSolverController;
}
Also used : LocalSolverController(cbit.vcell.solvers.LocalSolverController)

Example 4 with LocalSolverController

use of cbit.vcell.solvers.LocalSolverController 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)

Example 5 with LocalSolverController

use of cbit.vcell.solvers.LocalSolverController 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)

Aggregations

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