Search in sources :

Example 26 with SimulationStatus

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())));
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) Simulation(cbit.vcell.solver.Simulation) SimulationStatus(cbit.vcell.server.SimulationStatus) ApplicationComponents(cbit.vcell.client.desktop.biomodel.ApplicationComponents) DataEvent(cbit.vcell.simdata.DataEvent) SimulationContext(cbit.vcell.mapping.SimulationContext) VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier)

Example 27 with SimulationStatus

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;
}
Also used : VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) SimulationStatus(cbit.vcell.server.SimulationStatus)

Aggregations

SimulationStatus (cbit.vcell.server.SimulationStatus)27 Simulation (cbit.vcell.solver.Simulation)13 SimulationInfo (cbit.vcell.solver.SimulationInfo)8 ArrayList (java.util.ArrayList)7 Hashtable (java.util.Hashtable)5 Vector (java.util.Vector)5 KeyValue (org.vcell.util.document.KeyValue)5 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)4 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)4 BioModel (cbit.vcell.biomodel.BioModel)3 MathDescription (cbit.vcell.math.MathDescription)2 MathModel (cbit.vcell.mathmodel.MathModel)2 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)2 TestCaseNew (cbit.vcell.numericstest.TestCaseNew)2 ExpressionException (cbit.vcell.parser.ExpressionException)2 VCSimulationIdentifier (cbit.vcell.solver.VCSimulationIdentifier)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 JLabel (javax.swing.JLabel)2 JProgressBar (javax.swing.JProgressBar)2