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();
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations