use of cbit.vcell.server.SimulationStatusPersistent in project vcell by virtualcell.
the class LocalUserMetaDbServerMessaging method getSimulationStatus.
/**
* Insert the method's description here.
* Creation date: (9/1/2004 11:27:01 AM)
* @return cbit.vcell.solver.SolverResultSetInfo
* @param simKey cbit.sql.KeyValue
* @throws RemoteException
*/
public SimulationStatusPersistent[] getSimulationStatus(org.vcell.util.document.KeyValue[] simulationKeys) throws DataAccessException, ObjectNotFoundException {
try {
log.print("LocalUserMetaDbServerMessaging.getSimulationStatus(key=" + simulationKeys + ")");
SimulationStatusPersistent[] simulationStatus = dbServerProxy.getSimulationStatus(simulationKeys);
return simulationStatus;
} catch (DataAccessException e) {
log.exception(e);
throw e;
} catch (Throwable e) {
log.exception(e);
throw new DataAccessException(e.getMessage());
}
}
use of cbit.vcell.server.SimulationStatusPersistent in project vcell by virtualcell.
the class VCComprehensiveStatistics method collectBioModelStats.
private void collectBioModelStats(long startDateInMs, long endDateInMs) throws DataAccessException {
retrieveUsers();
for (User user : userList) {
if (!userConstraintList.contains(user.getName())) {
continue;
}
if (!internalDeveloper.contains(user.getName())) {
boolean bInternal = internalUsers.contains(user.getName());
ModelStat modelStat = bioModelStats[bInternal ? 0 : 1];
BioModelInfo[] bioModelInfos = dbServerImpl.getBioModelInfos(user, false);
for (BioModelInfo bmi : bioModelInfos) {
Date createDate = bmi.getVersion().getDate();
long t = createDate.getTime();
// }
if (t < startDateInMs || t > endDateInMs) {
continue;
}
// modelStat.count_model ++;
try {
BigString bioModelXML = dbServerImpl.getBioModelXML(user, bmi.getVersion().getVersionKey());
BioModel bioModel = (BioModel) waitForModel(bioModelXML, false);
if (bioModel == null) {
System.out.println("---------- Skipped BioModel " + bmi.getVersion() + " ----------");
continue;
}
modelStat.count_model++;
for (SimulationContext simContext : bioModel.getSimulationContexts()) {
modelStat.count_geoDimApplications[simContext.getGeometry().getDimension()]++;
if (simContext.isStoch()) {
modelStat.count_app_stochastic++;
} else {
modelStat.count_app_deterministic++;
}
}
boolean bHasCompletedSim = false;
for (Simulation sim : bioModel.getSimulations()) {
SimulationStatusPersistent ss = dbServerImpl.getSimulationStatus(sim.getKey());
if (ss != null) {
for (int scan = 0; scan < sim.getScanCount(); scan++) {
SimulationJobStatusPersistent jobStatus = ss.getJobStatus(scan);
if (jobStatus != null) {
if (jobStatus.getSchedulerStatus() == SchedulerStatus.COMPLETED) {
bHasCompletedSim = true;
long elapsed = jobStatus.getEndDate().getTime() - jobStatus.getStartDate().getTime();
if (elapsed < 2 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[0]++;
} else if (elapsed < 5 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[1]++;
} else if (elapsed < 20 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[2]++;
} else if (elapsed < HOUR_IN_MS) {
modelStat.runningTimeHistogram[3]++;
} else if (elapsed < DAY_IN_MS) {
modelStat.runningTimeHistogram[4]++;
} else {
modelStat.runningTimeHistogram[5]++;
}
}
int dimension = sim.getMathDescription().getGeometry().getDimension();
modelStat.count_geoDimSim[dimension]++;
if (sim.getMathDescription().isNonSpatialStoch() || sim.getMathDescription().isSpatialStoch()) {
modelStat.count_sim_stochastic++;
} else {
modelStat.count_sim_deterministic++;
}
if (dimension > 0) {
if (sim.getSolverTaskDescription().getSolverDescription().isSemiImplicitPdeSolver()) {
modelStat.count_semiSim++;
} else {
modelStat.count_fullySim++;
}
}
}
}
}
}
if (bHasCompletedSim) {
modelStat.count_model_simcomplete++;
}
} catch (Exception e2) {
e2.printStackTrace(System.out);
}
}
}
}
itemCount++;
statOutputPW.println(itemCount + ". BioModel Statistics ");
statOutputPW.println("====================================================");
for (ModelStat modelStat : bioModelStats) {
statOutputPW.println("\t" + modelStat.title);
statOutputPW.println("========================================");
statOutputPW.println("number of biomodels saved :\t" + modelStat.count_model);
statOutputPW.println("number of biomodels that has at least 1 completed simulation :\t" + modelStat.count_model_simcomplete);
statOutputPW.println();
statOutputPW.println("Application statistics :");
statOutputPW.println("number of application ODE :\t" + modelStat.count_geoDimApplications[0]);
statOutputPW.println("number of application 1D :\t" + modelStat.count_geoDimApplications[1]);
statOutputPW.println("number of application 2D :\t" + modelStat.count_geoDimApplications[2]);
statOutputPW.println("number of application 3D :\t" + modelStat.count_geoDimApplications[3]);
statOutputPW.println("number of application stochastic :\t" + modelStat.count_app_stochastic);
statOutputPW.println("number of application deterministic :\t" + modelStat.count_app_deterministic);
statOutputPW.println();
statOutputPW.println("Simulation statistics (including all simulations (stopped, failed, completed) :");
statOutputPW.println("number of run simulation ODE :\t" + modelStat.count_geoDimSim[0]);
statOutputPW.println("number of run simulation 1D :\t" + modelStat.count_geoDimSim[1]);
statOutputPW.println("number of run simulation 2D :\t" + modelStat.count_geoDimSim[2]);
statOutputPW.println("number of run simulation 3D :\t" + modelStat.count_geoDimSim[3]);
statOutputPW.println("number of run simulation Semi-Implicit :\t" + modelStat.count_semiSim);
statOutputPW.println("number of run simulation Fully-Implicit :\t" + modelStat.count_fullySim);
statOutputPW.println("number of run simulation stochastic :\t" + modelStat.count_sim_stochastic);
statOutputPW.println("number of run simulation deterministic :\t" + modelStat.count_sim_deterministic);
statOutputPW.println();
statOutputPW.println("Running time histogram for completed simulations only:");
statOutputPW.println("0 ~ 2min:\t" + modelStat.runningTimeHistogram[0]);
statOutputPW.println("2 ~ 5min:\t" + modelStat.runningTimeHistogram[1]);
statOutputPW.println("5 ~ 20min:\t" + modelStat.runningTimeHistogram[2]);
statOutputPW.println("20min ~ 1hr:\t" + modelStat.runningTimeHistogram[3]);
statOutputPW.println("1hr ~ 1day:\t" + modelStat.runningTimeHistogram[4]);
statOutputPW.println(">1day:\t" + modelStat.runningTimeHistogram[5]);
statOutputPW.println();
statOutputPW.println();
statOutputPW.flush();
}
}
use of cbit.vcell.server.SimulationStatusPersistent in project vcell by virtualcell.
the class TestMissingSimData method runSim.
private static void runSim(SimIDAndJobID simIDAndJobID) throws Exception {
if (notCompletedSimIDs.contains(simIDAndJobID.simID.toString())) {
// System.out.println("--skipping notCompleted");
return;
} else if (completedSimIDs.contains(simIDAndJobID.simID.toString())) {
System.out.println("-----unexpected sim rerun already completed once");
return;
}
VCSimulationIdentifier vcSimulationIdentifier = new VCSimulationIdentifier(simIDAndJobID.simID, simIDAndJobID.user);
UserLoginInfo userLoginInfo = new UserLoginInfo(simIDAndJobID.user.getName(), new DigestedPassword("xoxoxox"));
// getVcellClient().getClientServerManager().getConnectionStatus()
VCellConnection vcellConnection = userConnections.get(simIDAndJobID.user);
try {
if (vcellConnection != null) {
vcellConnection.getMessageEvents();
}
} catch (Exception e) {
e.printStackTrace();
// assume disconnected
vcellConnection = null;
}
if (vcellConnection == null) {
VCellBootstrap vCellBootstrap = getVCellBootstrap("rmi-alpha.cam.uchc.edu", 40106, "VCellBootstrapServer", 12, false);
vcellConnection = vCellBootstrap.getVCellConnection(userLoginInfo);
userConnections.put(simIDAndJobID.user, vcellConnection);
}
SimulationStatusPersistent finalSimStatus = null;
try {
SimulationStatusPersistent simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
System.out.println("initial status=" + simulationStatus);
BigString simXML = vcellConnection.getUserMetaDbServer().getSimulationXML(vcSimulationIdentifier.getSimulationKey());
Simulation sim = XmlHelper.XMLToSim(simXML.toString());
SolverDescription solverDescription = sim.getSolverTaskDescription().getSolverDescription();
if (solverDescription.equals(SolverDescription.StochGibson) || solverDescription.equals(SolverDescription.FiniteVolume)) {
// These 2 solvers give too much trouble so skip
System.out.println("--skipping solver");
// notCompletedSimIDs.add(simIDAndJobID.simID.toString());
return;
}
int scanCount = sim.getScanCount();
vcellConnection.getSimulationController().startSimulation(vcSimulationIdentifier, scanCount);
long startTime = System.currentTimeMillis();
while (simulationStatus.isStopped() || simulationStatus.isCompleted() || simulationStatus.isFailed()) {
Thread.sleep(250);
simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
MessageEvent[] messageEvents = vcellConnection.getMessageEvents();
if ((System.currentTimeMillis() - startTime) > 60000) {
System.out.println("-----Sim finished too fast or took too long to start");
return;
}
// System.out.println(simulationStatus);
}
SimulationStatusPersistent lastSimStatus = simulationStatus;
while (!simulationStatus.isStopped() && !simulationStatus.isCompleted() && !simulationStatus.isFailed()) {
Thread.sleep(3000);
simulationStatus = vcellConnection.getUserMetaDbServer().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
if (!simulationStatus.toString().equals(lastSimStatus.toString())) {
lastSimStatus = simulationStatus;
System.out.println("running status=" + simulationStatus);
}
// System.out.println(simulationStatus);
MessageEvent[] messageEvents = vcellConnection.getMessageEvents();
// for (int i = 0; messageEvents != null && i < messageEvents.length; i++) {
// System.out.println(messageEvents[i]);
// }
}
finalSimStatus = simulationStatus;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
} finally {
System.out.println("final status=" + finalSimStatus + "\n");
if (finalSimStatus == null || !finalSimStatus.isCompleted()) {
notCompletedSimIDs.add(simIDAndJobID.simID.toString());
} else {
completedSimIDs.add(simIDAndJobID.simID.toString());
}
}
}
use of cbit.vcell.server.SimulationStatusPersistent in project vcell by virtualcell.
the class TestMissingSimData method startClient.
private static void startClient(VCSimulationIdentifier vcSimulationIdentifier, UserLoginInfo userLoginInfo) throws Exception {
ClientServerInfo clientServerInfo = ClientServerInfo.createRemoteServerInfo("vcellapi.cam.uchc.edu", 443, userLoginInfo.getUserName(), userLoginInfo.getDigestedPassword());
VCellClient vCellClient = VCellClient.startClient(null, clientServerInfo);
while (vCellClient.getClientServerManager() == null || vCellClient.getClientServerManager().getConnectionStatus() == null || vCellClient.getClientServerManager().getConnectionStatus().getStatus() != ConnectionStatus.CONNECTED) {
Thread.sleep(1000);
System.out.println("trying connect");
}
BigString simXML = vCellClient.getClientServerManager().getUserMetaDbServer().getSimulationXML(vcSimulationIdentifier.getSimulationKey());
Simulation sim = XmlHelper.XMLToSim(simXML.toString());
vCellClient.getClientServerManager().getJobManager().startSimulation(vcSimulationIdentifier, sim.getScanCount());
SimulationStatusPersistent simulationStatus = null;
while (true) {
simulationStatus = vCellClient.getClientServerManager().getUserMetaDbServer().getSimulationStatus(vcSimulationIdentifier.getSimulationKey());
System.out.println(simulationStatus);
if (simulationStatus.isCompleted() || simulationStatus.isFailed()) {
break;
}
Thread.sleep(1000);
// MessageEvent[] messageEvents = vcellConnection.getMessageEvents();
// for (int i = 0; messageEvents != null && i < messageEvents.length; i++) {
// System.out.println(messageEvents[i]);
// }
}
}
use of cbit.vcell.server.SimulationStatusPersistent in project vcell by virtualcell.
the class VCComprehensiveStatistics method collectMathModelStats.
private void collectMathModelStats(long startDateInMs, long endDateInMs) throws DataAccessException {
retrieveUsers();
List<String> internalDeveloper = Arrays.asList(VCComprehensiveStatistics.INTERNAL_DEVELOPERS);
for (User user : userList) {
if (!userConstraintList.contains(user.getName())) {
continue;
}
if (!internalDeveloper.contains(user.getName())) {
boolean bInternal = internalUsers.contains(user.getName());
ModelStat modelStat = mathModelStats[bInternal ? 0 : 1];
MathModelInfo[] mathModelInfos = dbServerImpl.getMathModelInfos(user, false);
for (MathModelInfo mmi : mathModelInfos) {
Date createDate = mmi.getVersion().getDate();
long t = createDate.getTime();
// }
if (t < startDateInMs || t > endDateInMs) {
continue;
}
// modelStat.count_model ++;
try {
BigString mathModelXML = dbServerImpl.getMathModelXML(user, mmi.getVersion().getVersionKey());
MathModel mathModel = (MathModel) waitForModel(mathModelXML, true);
if (mathModel == null) {
System.out.println("---------- Skipped MathModel " + mmi.getVersion() + " ----------");
continue;
}
modelStat.count_model++;
boolean bHasCompletedSim = false;
for (Simulation sim : mathModel.getSimulations()) {
SimulationStatusPersistent ss = dbServerImpl.getSimulationStatus(sim.getKey());
for (int scan = 0; ss != null && scan < sim.getScanCount(); scan++) {
SimulationJobStatusPersistent jobStatus = ss.getJobStatus(scan);
if (jobStatus != null) {
if (jobStatus.getSchedulerStatus() == SchedulerStatus.COMPLETED) {
bHasCompletedSim = true;
long elapsed = jobStatus.getEndDate().getTime() - jobStatus.getStartDate().getTime();
if (elapsed < 2 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[0]++;
} else if (elapsed < 5 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[1]++;
} else if (elapsed < 20 * MINUTE_IN_MS) {
modelStat.runningTimeHistogram[2]++;
} else if (elapsed < HOUR_IN_MS) {
modelStat.runningTimeHistogram[3]++;
} else if (elapsed < DAY_IN_MS) {
modelStat.runningTimeHistogram[4]++;
} else {
modelStat.runningTimeHistogram[5]++;
}
}
int dimension = sim.getMathDescription().getGeometry().getDimension();
modelStat.count_geoDimSim[dimension]++;
if (sim.getMathDescription().isNonSpatialStoch()) {
modelStat.count_sim_stochastic++;
} else {
modelStat.count_sim_deterministic++;
}
if (dimension > 0) {
if (sim.getSolverTaskDescription().getSolverDescription().isSemiImplicitPdeSolver()) {
modelStat.count_semiSim++;
} else {
modelStat.count_fullySim++;
}
}
}
}
}
if (bHasCompletedSim) {
modelStat.count_model_simcomplete++;
}
} catch (Exception e2) {
e2.printStackTrace(System.out);
}
}
}
}
itemCount++;
statOutputPW.println(itemCount + ". MathModel Statistics ");
statOutputPW.println("====================================================");
for (ModelStat modelStat : mathModelStats) {
statOutputPW.println("\t" + modelStat.title);
statOutputPW.println("========================================");
statOutputPW.println("number of mathmodels saved :\t" + modelStat.count_model);
statOutputPW.println("number of mathmodels that has at least 1 completed simulation :\t" + modelStat.count_model_simcomplete);
statOutputPW.println();
statOutputPW.println("Simulation statistics (including all simulations (stopped, failed, completed) :");
statOutputPW.println("number of run simulation ODE :\t" + modelStat.count_geoDimSim[0]);
statOutputPW.println("number of run simulation 1D :\t" + modelStat.count_geoDimSim[1]);
statOutputPW.println("number of run simulation 2D :\t" + modelStat.count_geoDimSim[2]);
statOutputPW.println("number of run simulation 3D :\t" + modelStat.count_geoDimSim[3]);
statOutputPW.println("number of run simulation Semi-Implicit :\t" + modelStat.count_semiSim);
statOutputPW.println("number of run simulation Fully-Implicit :\t" + modelStat.count_fullySim);
statOutputPW.println("number of run simulation stochastic :\t" + modelStat.count_sim_stochastic);
statOutputPW.println("number of run simulation deterministic :\t" + modelStat.count_sim_deterministic);
statOutputPW.println();
statOutputPW.println("Running time histogram for completed simulations only:");
statOutputPW.println("0 ~ 2min:\t" + modelStat.runningTimeHistogram[0]);
statOutputPW.println("2 ~ 5min:\t" + modelStat.runningTimeHistogram[1]);
statOutputPW.println("5 ~ 20min:\t" + modelStat.runningTimeHistogram[2]);
statOutputPW.println("20min ~ 1hr:\t" + modelStat.runningTimeHistogram[3]);
statOutputPW.println("1hr ~ 1day:\t" + modelStat.runningTimeHistogram[4]);
statOutputPW.println(">1day:\t" + modelStat.runningTimeHistogram[5]);
statOutputPW.println();
statOutputPW.println();
statOutputPW.flush();
}
}
Aggregations