use of cbit.vcell.server.SimulationStatus in project vcell by virtualcell.
the class BioModelWindowManager method simStatusChanged.
/**
* Insert the method's description here.
* Creation date: (6/9/2004 3:58:21 PM)
* @param newJobStatus cbit.vcell.messaging.db.SimulationJobStatus
* @param progress java.lang.Double
* @param timePoint java.lang.Double
*/
public void simStatusChanged(SimStatusEvent simStatusEvent) {
// ** events are only generated from server side job statuses **
KeyValue simKey = simStatusEvent.getVCSimulationIdentifier().getSimulationKey();
// do we have the sim?
Simulation[] sims = getBioModel().getSimulations();
if (sims == null) {
// we don't have it
return;
}
Simulation simulation = null;
for (int i = 0; i < sims.length; i++) {
if (sims[i].getSimulationInfo() != null && simKey.equals(sims[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier().getSimulationKey())) {
simulation = sims[i];
break;
}
}
if (simulation == null) {
// we don't have it
return;
}
// we have it; get current server side status
SimulationStatus simStatus = getRequestManager().getServerSimulationStatus(simulation.getSimulationInfo());
// if failed, notify
if (simStatusEvent.isNewFailureEvent()) {
String qualifier = "";
if (simulation.getScanCount() > 1) {
qualifier += "One job from ";
}
PopupGenerator.showErrorDialog(this, qualifier + "Simulation '" + simulation.getName() + "' failed\n" + simStatus.getDetails());
}
// was the gui on it ever opened?
SimulationContext simContext = null;
simulation = null;
Enumeration<SimulationContext> en = getApplicationsHash().keys();
while (en.hasMoreElements()) {
SimulationContext sc = (SimulationContext) en.nextElement();
sims = sc.getSimulations();
if (sims != null) {
}
for (int i = 0; i < sims.length; i++) {
if (sims[i].getSimulationInfo() != null && simKey.equals(sims[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier().getSimulationKey())) {
simulation = sims[i];
break;
}
}
if (simulation != null) {
simContext = sc;
break;
}
}
if (simulation == null || simContext == null) {
return;
}
// the gui was opened, update status display
ApplicationComponents appComponents = (ApplicationComponents) getApplicationsHash().get(simContext);
ClientSimManager simManager = appComponents.getSimulationWorkspace().getClientSimManager();
simManager.updateStatusFromServer(simulation);
// is there new data?
if (simStatusEvent.isNewDataEvent()) {
fireNewData(new DataEvent(this, new VCSimulationDataIdentifier(simulation.getSimulationInfo().getAuthoritativeVCSimulationIdentifier(), simStatusEvent.getJobIndex())));
}
}
use of cbit.vcell.server.SimulationStatus in project vcell by virtualcell.
the class ClientRequestManager method getServerSimulationStatus.
/**
* Insert the method's description here.
* Creation date: (6/7/2004 1:27:25 PM)
* @return cbit.vcell.solver.ode.gui.SimulationStatus
* @param simulation cbit.vcell.solver.Simulation
*/
public SimulationStatus getServerSimulationStatus(SimulationInfo simInfo) {
SimulationStatus simStatus = null;
if (simInfo == null) {
// unsaved simulation ... won't have simulation status
return null;
}
try {
VCSimulationIdentifier vcSimulationIdentifier = simInfo.getAuthoritativeVCSimulationIdentifier();
simStatus = getClientServerManager().getJobManager().getServerSimulationStatus(vcSimulationIdentifier);
} catch (Throwable exc) {
exc.printStackTrace(System.out);
}
return simStatus;
}
Aggregations