Search in sources :

Example 11 with SimulationStatus

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

the class SimulationDatabaseDirect method getSimulationStatus.

@Override
public SimulationStatus[] getSimulationStatus(KeyValue[] simKeys) throws ObjectNotFoundException, DataAccessException {
    SimulationStatusPersistent[] simStatusDbArray = databaseServerImpl.getSimulationStatus(simKeys);
    ArrayList<SimulationStatus> simStatusList = new ArrayList<SimulationStatus>();
    for (SimulationStatusPersistent simStatusDb : simStatusDbArray) {
        if (simStatusDb != null) {
            simStatusList.add(buildSimulationStatus(simStatusDb));
        } else {
            simStatusList.add(null);
        }
    }
    return simStatusList.toArray(new SimulationStatus[0]);
}
Also used : SimulationStatus(cbit.vcell.server.SimulationStatus) ArrayList(java.util.ArrayList) SimulationStatusPersistent(cbit.vcell.server.SimulationStatusPersistent)

Example 12 with SimulationStatus

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

the class SimulationDatabaseDirect method buildSimulationStatus.

private SimulationStatus buildSimulationStatus(SimulationStatusPersistent simStatusDB) throws ObjectNotFoundException, DataAccessException {
    SimulationStatus simulationStatus = translateToSimulationStatusTransient(simStatusDB);
    // replace SimulationJobStatus from cache when possible
    ArrayList<SimulationJobStatus> simJobStatusList = new ArrayList<SimulationJobStatus>();
    int index = 0;
    while (simulationStatus.getJobStatus(index) != null) {
        SimulationJobStatus simJobStatusDb = simulationStatus.getJobStatus(index);
        SimJobStatusKey key = new SimJobStatusKey(simJobStatusDb.getVCSimulationIdentifier().getSimulationKey(), simJobStatusDb.getJobIndex(), simJobStatusDb.getTaskID());
        SimStatusCacheEntry entry = cache.get(key);
        if (entry != null) {
            // assume cache is more recent
            simJobStatusList.add(entry.jobStatus);
        } else {
            simJobStatusList.add(simJobStatusDb);
            cache.put(key, new SimStatusCacheEntry(simJobStatusDb, null));
        }
        index++;
    }
    SimulationStatus newSimStatus = new SimulationStatus(simJobStatusList.toArray(new SimulationJobStatus[simJobStatusList.size()]));
    return newSimStatus;
}
Also used : SimulationStatus(cbit.vcell.server.SimulationStatus) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus) ArrayList(java.util.ArrayList)

Example 13 with SimulationStatus

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

the class SimulationDatabaseDirect method translateToSimulationStatusTransient.

private SimulationStatus translateToSimulationStatusTransient(SimulationStatusPersistent simStatusPersistent) {
    SimulationJobStatus[] simJobStatusArray = new SimulationJobStatus[simStatusPersistent.getJobStatuses().length];
    for (int i = 0; i < simJobStatusArray.length; i++) {
        simJobStatusArray[i] = translateToSimulationJobStatusTransient(simStatusPersistent.getJobStatus(i));
    }
    SimulationStatus simStatus = new SimulationStatus(simJobStatusArray);
    return simStatus;
}
Also used : SimulationStatus(cbit.vcell.server.SimulationStatus) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus)

Example 14 with SimulationStatus

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

the class ClientDocumentManager method getServerSimulationStatus.

/**
 * Insert the method's description here.
 * Creation date: (9/1/2004 10:48:52 AM)
 * @return cbit.vcell.solver.ode.gui.SimulationStatus
 * @param vcSimulationIdentifier cbit.vcell.solver.VCSimulationIdentifier
 */
public SimulationStatus getServerSimulationStatus(VCSimulationIdentifier vcSimulationIdentifier) throws DataAccessException {
    if (simulationStatusHash.containsKey(vcSimulationIdentifier.getSimulationKey())) {
        return (SimulationStatus) simulationStatusHash.get(vcSimulationIdentifier.getSimulationKey());
    } else {
        SimulationStatus simulationStatus = null;
        try {
            simulationStatus = sessionManager.getSimulationController().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
        } catch (RemoteProxyException e) {
            handleRemoteProxyException(e);
            try {
                simulationStatus = sessionManager.getSimulationController().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
            } catch (RemoteProxyException e2) {
                handleRemoteProxyException(e2);
                throw new DataAccessException("SimulationStatus inquiry for '" + vcSimulationIdentifier + "' failed\n" + e2.getMessage());
            }
        }
        simulationStatusHash.put(vcSimulationIdentifier.getSimulationKey(), simulationStatus);
        return simulationStatus;
    }
}
Also used : SimulationStatus(cbit.vcell.server.SimulationStatus) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 15 with SimulationStatus

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

the class ClientDocumentManager method preloadSimulationStatus.

/**
 * Insert the method's description here.
 * Creation date: (9/1/2004 12:33:16 PM)
 * @param simKeys cbit.sql.KeyValue[]
 */
private void preloadSimulationStatus(KeyValue[] simKeys) {
    boolean bNeedRefreshStatus = false;
    for (int i = 0; i < simKeys.length; i++) {
        if (!simulationStatusHash.containsKey(simKeys[i])) {
            bNeedRefreshStatus = true;
        }
    }
    if (bNeedRefreshStatus) {
        try {
            SimulationStatus[] simulationStatusArray = null;
            try {
                simulationStatusArray = sessionManager.getSimulationController().getSimulationStatus(simKeys);
            } catch (RemoteProxyException e) {
                handleRemoteProxyException(e);
                try {
                    simulationStatusArray = sessionManager.getSimulationController().getSimulationStatus(simKeys);
                } catch (RemoteProxyException e2) {
                    handleRemoteProxyException(e2);
                }
            }
            for (int i = 0; i < simKeys.length; i++) {
                SimulationStatus simulationStatus = null;
                for (int j = 0; simulationStatusArray != null && j < simulationStatusArray.length; j++) {
                    // these are server-supplied statuses, jobStatus array is not null
                    if (simulationStatusArray[j] != null && simulationStatusArray[j].getVCSimulationIdentifier().getSimulationKey().equals(simKeys[i])) {
                        simulationStatus = simulationStatusArray[j];
                    }
                }
                simulationStatusHash.put(simKeys[i], simulationStatus);
            }
        } catch (DataAccessException e) {
            e.printStackTrace(System.out);
        }
    }
}
Also used : SimulationStatus(cbit.vcell.server.SimulationStatus) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

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