use of cbit.vcell.message.server.dispatcher.SimulationDatabase in project vcell by virtualcell.
the class ServerManageConsole method query.
/**
* Insert the method's description here.
* Creation date: (9/3/2003 8:00:07 AM)
*/
private void query() {
boolean bOtherConditions = false;
getRemoveFromListButton().setEnabled(false);
getSubmitSelectedButton().setEnabled(false);
getStopSelectedButton().setEnabled(false);
SimpleJobStatusQuerySpec querySpec = new SimpleJobStatusQuerySpec();
querySpec.maxRows = 1000;
String text = getQuerySimField().getText();
if (text != null && text.trim().length() > 0) {
try {
bOtherConditions = true;
long simID = Long.parseLong(text);
querySpec.simId = simID;
} catch (NumberFormatException ex) {
}
}
text = getQueryHostField().getText();
if (text != null && text.trim().length() > 0) {
bOtherConditions = true;
querySpec.computeHost = text.toLowerCase();
}
text = getQueryServerIDField().getText();
if (text != null && text.trim().length() > 0) {
bOtherConditions = true;
querySpec.serverId = text.toLowerCase();
}
text = getQueryUserField().getText();
if (text != null && text.trim().length() > 0) {
bOtherConditions = true;
querySpec.userid = text;
}
boolean bAllStatus = getQueryAllStatusCheck().isSelected();
querySpec.waiting = bAllStatus || getQueryWaitingCheck().isSelected();
querySpec.queued = bAllStatus || getQueryQueuedCheck().isSelected();
querySpec.dispatched = bAllStatus || getQueryDispatchedCheck().isSelected();
querySpec.running = bAllStatus || getQueryRunningCheck().isSelected();
querySpec.completed = bAllStatus || getQueryCompletedCheck().isSelected();
querySpec.stopped = bAllStatus || getQueryStoppedCheck().isSelected();
querySpec.failed = bAllStatus || getQueryFailedCheck().isSelected();
if (getQuerySubmitDateCheck().isSelected()) {
bOtherConditions = true;
// first second of day low time
querySpec.submitLowMS = getQuerySubmitFromDate().getDate().getTime();
// last second of dat high time
querySpec.submitHighMS = getQuerySubmitToDate().getDate().getTime() + TimeUnit.DAYS.toMillis(1) - 1;
}
if (getQueryStartDateCheck().isSelected()) {
bOtherConditions = true;
// first second of day low time
querySpec.startLowMS = getQueryStartFromDate().getDate().getTime();
// last second of dat high time
querySpec.startHighMS = getQueryStartToDate().getDate().getTime() + TimeUnit.DAYS.toMillis(1) - 1;
}
if (getQueryEndDateCheck().isSelected()) {
bOtherConditions = true;
// first second of day low time
querySpec.endLowMS = getQueryEndFromDate().getDate().getTime();
// last second of dat high time
querySpec.endHighMS = getQueryEndToDate().getDate().getTime() + TimeUnit.DAYS.toMillis(1) - 1;
}
if (getQueryCompletedCheck().isSelected() && !bOtherConditions) {
int n = javax.swing.JOptionPane.showConfirmDialog(this, "You are gonna get all the completed simulation jobs in the database, which is gonna be huge . Continue?", "Confirm", javax.swing.JOptionPane.YES_NO_OPTION);
if (n == javax.swing.JOptionPane.NO_OPTION) {
getNumResultsLabel().setText("0");
getNumSelectedLabel().setText("0");
((JobTableModel) getQueryResultTable().getModel()).setData(null);
return;
}
}
try {
SimulationDatabase simDatabase = new SimulationDatabaseDirect(adminDbTop, dbServerImpl, false);
SimpleJobStatus[] resultList = simDatabase.getSimpleJobStatus(null, querySpec);
getNumResultsLabel().setText("" + resultList.length);
getNumSelectedLabel().setText("0");
((JobTableModel) getQueryResultTable().getModel()).setData(Arrays.asList(resultList));
} catch (Exception ex) {
getNumResultsLabel().setText("Query failed, please try again!");
((JobTableModel) getQueryResultTable().getModel()).setData(null);
}
}
use of cbit.vcell.message.server.dispatcher.SimulationDatabase in project vcell by virtualcell.
the class VCellServices method main.
/**
* Starts the application.
* @param args an array of command-line arguments
*/
public static void main(java.lang.String[] args) {
OperatingSystemInfo.getInstance();
if (args.length != 3 && args.length != 0) {
System.out.println("Missing arguments: " + VCellServices.class.getName() + " [sshHost sshUser sshKeyFile] ");
System.exit(1);
}
try {
PropertyLoader.loadProperties(REQUIRED_SERVICE_PROPERTIES);
ResourceUtil.setNativeLibraryDirectory();
new LibraryLoaderThread(false).start();
PythonSupport.verifyInstallation(new PythonPackage[] { PythonPackage.VTK, PythonPackage.THRIFT });
HtcProxy htcProxy = SlurmProxy.creatCommandService(args);
int serviceOrdinal = 0;
VCMongoMessage.serviceStartup(ServiceName.dispatch, new Integer(serviceOrdinal), args);
// //
// // JMX registration
// //
// MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
ServiceInstanceStatus serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.MASTER, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory();
KeyFactory keyFactory = conFactory.getKeyFactory();
DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(conFactory, keyFactory);
AdminDBTopLevel adminDbTopLevel = new AdminDBTopLevel(conFactory);
SimulationDatabase simulationDatabase = new SimulationDatabaseDirect(adminDbTopLevel, databaseServerImpl, true);
String cacheSize = PropertyLoader.getRequiredProperty(PropertyLoader.simdataCacheSizeProperty);
long maxMemSize = Long.parseLong(cacheSize);
Cachetable cacheTable = new Cachetable(MessageConstants.MINUTE_IN_MS * 20, maxMemSize);
DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cacheTable, new File(PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty)), new File(PropertyLoader.getProperty(PropertyLoader.secondarySimDataDirInternalProperty, PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty))));
ExportServiceImpl exportServiceImpl = new ExportServiceImpl();
// add dataJobListener
DataServerImpl dataServerImpl = new DataServerImpl(dataSetControllerImpl, exportServiceImpl);
VCMessagingService vcMessagingService_int = new VCMessagingServiceActiveMQ();
String jmshost_int = PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntHostInternal);
int jmsport_int = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsIntPortInternal));
vcMessagingService_int.setConfiguration(new ServerMessagingDelegate(), jmshost_int, jmsport_int);
VCMessagingService vcMessagingService_sim = new VCMessagingServiceActiveMQ();
String jmshost_sim = PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimHostInternal);
int jmsport_sim = Integer.parseInt(PropertyLoader.getRequiredProperty(PropertyLoader.jmsSimPortInternal));
vcMessagingService_sim.setConfiguration(new ServerMessagingDelegate(), jmshost_sim, jmsport_sim);
VCellServices vcellServices = new VCellServices(htcProxy, vcMessagingService_int, vcMessagingService_sim, serviceInstanceStatus, databaseServerImpl, dataServerImpl, simulationDatabase);
dataSetControllerImpl.addDataJobListener(vcellServices);
exportServiceImpl.addExportListener(vcellServices);
vcellServices.init();
} catch (Throwable e) {
e.printStackTrace(System.out);
}
}
use of cbit.vcell.message.server.dispatcher.SimulationDatabase in project vcell by virtualcell.
the class AdminService method query.
public SimulationJobStatus[] query(SimpleJobStatusQuerySpec querySpec) throws ObjectNotFoundException, DataAccessException {
SimulationDatabase simDatabase = new SimulationDatabaseDirect(adminDbTop, dbServerImpl, false);
SimulationJobStatus[] resultList = simDatabase.queryJobs(querySpec);
return resultList;
}
Aggregations