Search in sources :

Example 1 with SimulationDatabase

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);
    }
}
Also used : SimpleJobStatusQuerySpec(cbit.vcell.server.SimpleJobStatusQuerySpec) SimulationDatabase(cbit.vcell.message.server.dispatcher.SimulationDatabase) SimulationDatabaseDirect(cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect) BigString(org.vcell.util.BigString) UserCancelException(org.vcell.util.UserCancelException) SimpleJobStatus(cbit.vcell.server.SimpleJobStatus)

Example 2 with SimulationDatabase

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);
    }
}
Also used : Cachetable(cbit.vcell.simdata.Cachetable) DataServerImpl(cbit.vcell.simdata.DataServerImpl) ServerMessagingDelegate(cbit.vcell.message.server.ServerMessagingDelegate) AdminDBTopLevel(cbit.vcell.modeldb.AdminDBTopLevel) HtcProxy(cbit.vcell.message.server.htc.HtcProxy) SimulationDatabase(cbit.vcell.message.server.dispatcher.SimulationDatabase) VCMessagingService(cbit.vcell.message.VCMessagingService) LibraryLoaderThread(cbit.vcell.resource.LibraryLoaderThread) Date(java.util.Date) ConnectionFactory(org.vcell.db.ConnectionFactory) SimulationDatabaseDirect(cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) ExportServiceImpl(cbit.vcell.export.server.ExportServiceImpl) VCMessagingServiceActiveMQ(cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ) File(java.io.File) KeyFactory(org.vcell.db.KeyFactory)

Example 3 with SimulationDatabase

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;
}
Also used : SimulationDatabase(cbit.vcell.message.server.dispatcher.SimulationDatabase) SimulationDatabaseDirect(cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect) SimulationJobStatus(cbit.vcell.server.SimulationJobStatus)

Aggregations

SimulationDatabase (cbit.vcell.message.server.dispatcher.SimulationDatabase)3 SimulationDatabaseDirect (cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect)3 ExportServiceImpl (cbit.vcell.export.server.ExportServiceImpl)1 VCMessagingService (cbit.vcell.message.VCMessagingService)1 VCMessagingServiceActiveMQ (cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ)1 ServerMessagingDelegate (cbit.vcell.message.server.ServerMessagingDelegate)1 ServiceInstanceStatus (cbit.vcell.message.server.ServiceInstanceStatus)1 HtcProxy (cbit.vcell.message.server.htc.HtcProxy)1 AdminDBTopLevel (cbit.vcell.modeldb.AdminDBTopLevel)1 DatabaseServerImpl (cbit.vcell.modeldb.DatabaseServerImpl)1 LibraryLoaderThread (cbit.vcell.resource.LibraryLoaderThread)1 SimpleJobStatus (cbit.vcell.server.SimpleJobStatus)1 SimpleJobStatusQuerySpec (cbit.vcell.server.SimpleJobStatusQuerySpec)1 SimulationJobStatus (cbit.vcell.server.SimulationJobStatus)1 Cachetable (cbit.vcell.simdata.Cachetable)1 DataServerImpl (cbit.vcell.simdata.DataServerImpl)1 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)1 File (java.io.File)1 Date (java.util.Date)1 ConnectionFactory (org.vcell.db.ConnectionFactory)1