Search in sources :

Example 1 with VCellClient

use of cbit.vcell.client.VCellClient 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", 8080, 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]);
    // }
    }
}
Also used : Simulation(cbit.vcell.solver.Simulation) VCellClient(cbit.vcell.client.VCellClient) ClientServerInfo(cbit.vcell.client.server.ClientServerInfo) SimulationStatusPersistent(cbit.vcell.server.SimulationStatusPersistent) BigString(org.vcell.util.BigString)

Aggregations

VCellClient (cbit.vcell.client.VCellClient)1 ClientServerInfo (cbit.vcell.client.server.ClientServerInfo)1 SimulationStatusPersistent (cbit.vcell.server.SimulationStatusPersistent)1 Simulation (cbit.vcell.solver.Simulation)1 BigString (org.vcell.util.BigString)1