Search in sources :

Example 1 with ServiceInstanceStatus

use of cbit.vcell.message.server.ServiceInstanceStatus in project vcell by virtualcell.

the class ServerManageConsole method refresh.

private void refresh() {
    int count = getServiceStatusTable().getRowCount();
    boolean bAll = false;
    if (count == 0) {
        bAll = true;
    }
    int tabIndex = getTabbedPane().getSelectedIndex();
    if (tabIndex == 0 || tabIndex == 1) {
        final int waitingTimeSec = 5;
        Thread t = new Thread(new Runnable() {

            public void run() {
                getProgressBar().setMaximum(waitingTimeSec);
                getProgressBar().setMinimum(0);
                SwingUtilities.invokeLater(new Runnable() {

                    public void run() {
                        getProgressBar().setIndeterminate(true);
                        getRefreshButton().setEnabled(false);
                    }
                });
            }
        });
        t.setName("Refresh Thread");
        t.start();
        try {
            serviceConfigList = adminDbTop.getAllServiceStatus(true);
        } catch (Exception e) {
            e.printStackTrace();
            javax.swing.JOptionPane.showMessageDialog(this, e.getMessage(), "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
        }
        showConfigs(serviceConfigList);
        getModifyServiceButton().setEnabled(false);
        getDeleteServiceButton().setEnabled(false);
        if (!bAll && tabIndex == 0) {
            Thread t1 = new Thread(new Runnable() {

                public void run() {
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            getProgressBar().setIndeterminate(false);
                            getProgressBar().setValue(waitingTimeSec);
                            getRefreshButton().setEnabled(true);
                        }
                    });
                }
            });
            t1.setName("Refresh Thread");
            t1.start();
        } else {
            ((ServiceInstanceStatusTableModel) getServiceStatusTable().getModel()).setData(null);
            serviceInstanceStatusList.clear();
            for (int i = 0; i < serviceConfigList.size(); i++) {
                ServiceSpec ss = serviceConfigList.get(i).getServiceSpec();
                serviceInstanceStatusList.add(new ServiceInstanceStatus(ss.getServerID(), ss.getType(), ss.getOrdinal(), null, null, false));
            }
            showServices(serviceInstanceStatusList);
            Thread pingThread = new Thread(new Runnable() {

                public void run() {
                    // pingAll(waitingTimeSec);
                    SwingUtilities.invokeLater(new Runnable() {

                        public void run() {
                            getProgressBar().setIndeterminate(false);
                            getProgressBar().setValue(waitingTimeSec);
                            getRefreshButton().setEnabled(true);
                        }
                    });
                }
            });
            pingThread.setName("Refresh Thread");
            pingThread.start();
        }
    }
    return;
}
Also used : ServiceSpec(cbit.vcell.message.server.ServiceSpec) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) UserCancelException(org.vcell.util.UserCancelException)

Example 2 with ServiceInstanceStatus

use of cbit.vcell.message.server.ServiceInstanceStatus in project vcell by virtualcell.

the class VCellServices method init.

public void init() throws Exception {
    initControlTopicListener();
    ServiceInstanceStatus dispatcherServiceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DISPATCH, 99, ManageUtils.getHostName(), new Date(), true);
    simulationDispatcher = new SimulationDispatcher(htcProxy, vcMessagingService, dispatcherServiceInstanceStatus, simulationDatabase, true);
    simulationDispatcher.init();
    ServiceInstanceStatus databaseServiceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DB, 99, ManageUtils.getHostName(), new Date(), true);
    databaseServer = new DatabaseServer(databaseServiceInstanceStatus, databaseServerImpl, vcMessagingService, true);
    databaseServer.init();
    ServiceInstanceStatus simDataServiceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DATA, 99, ManageUtils.getHostName(), new Date(), true);
    simDataServer = new SimDataServer(simDataServiceInstanceStatus, dataServerImpl, vcMessagingService, true);
    simDataServer.init();
    ServiceInstanceStatus dataExportServiceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DATAEXPORT, 99, ManageUtils.getHostName(), new Date(), true);
    exportDataServer = new SimDataServer(dataExportServiceInstanceStatus, dataServerImpl, vcMessagingService, true);
    exportDataServer.init();
    ServiceInstanceStatus htcServiceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.PBSCOMPUTE, 99, ManageUtils.getHostName(), new Date(), true);
    htcSimulationWorker = new HtcSimulationWorker(htcProxy, vcMessagingService, htcServiceInstanceStatus, true);
    htcSimulationWorker.init();
    dataSession = vcMessagingService.createProducerSession();
    exportSession = vcMessagingService.createProducerSession();
}
Also used : SimDataServer(cbit.vcell.message.server.data.SimDataServer) SimulationDispatcher(cbit.vcell.message.server.dispatcher.SimulationDispatcher) HtcSimulationWorker(cbit.vcell.message.server.sim.HtcSimulationWorker) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServer(cbit.vcell.message.server.db.DatabaseServer) Date(java.util.Date)

Example 3 with ServiceInstanceStatus

use of cbit.vcell.message.server.ServiceInstanceStatus 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 });
        CommandService commandService = null;
        if (args.length == 3) {
            String sshHost = args[0];
            String sshUser = args[1];
            File sshKeyFile = new File(args[2]);
            try {
                commandService = new CommandServiceSshNative(sshHost, sshUser, sshKeyFile);
                commandService.command(new String[] { "/usr/bin/env bash -c ls | head -5" });
                lg.trace("SSH Connection test passed with installed keyfile, running ls as user " + sshUser + " on " + sshHost);
            } catch (Exception e) {
                e.printStackTrace();
                try {
                    commandService = new CommandServiceSshNative(sshHost, sshUser, sshKeyFile, new File("/root"));
                    commandService.command(new String[] { "/usr/bin/env bash -c ls | head -5" });
                    lg.trace("SSH Connection test passed after installing keyfile, running ls as user " + sshUser + " on " + sshHost);
                } catch (Exception e2) {
                    e.printStackTrace();
                    throw new RuntimeException("failed to establish an ssh command connection to " + sshHost + " as user '" + sshUser + "' using key '" + sshKeyFile + "'", e);
                }
            }
            // can't make user directories, they are remote.
            AbstractSolver.bMakeUserDirs = false;
        } else {
            commandService = new CommandServiceLocal();
        }
        BatchSystemType batchSystemType = BatchSystemType.SLURM;
        HtcProxy htcProxy = null;
        switch(batchSystemType) {
            case SLURM:
                {
                    htcProxy = new SlurmProxy(commandService, PropertyLoader.getRequiredProperty(PropertyLoader.htcUser));
                    break;
                }
            default:
                {
                    throw new RuntimeException("unrecognized batch scheduling option :" + batchSystemType);
                }
        }
        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);
        Cachetable cacheTable = new Cachetable(MessageConstants.MINUTE_IN_MS * 20);
        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 = VCellServiceHelper.getInstance().loadService(VCMessagingService.class);
        vcMessagingService.setDelegate(new ServerMessagingDelegate());
        VCellServices vcellServices = new VCellServices(htcProxy, vcMessagingService, 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) HtcProxy(cbit.vcell.message.server.htc.HtcProxy) CommandService(cbit.vcell.message.server.cmd.CommandService) VCMessagingService(cbit.vcell.message.VCMessagingService) ConnectionFactory(org.vcell.db.ConnectionFactory) SimulationDatabaseDirect(cbit.vcell.message.server.dispatcher.SimulationDatabaseDirect) CommandServiceLocal(cbit.vcell.message.server.cmd.CommandServiceLocal) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) ExportServiceImpl(cbit.vcell.export.server.ExportServiceImpl) KeyFactory(org.vcell.db.KeyFactory) AdminDBTopLevel(cbit.vcell.modeldb.AdminDBTopLevel) SimulationDatabase(cbit.vcell.message.server.dispatcher.SimulationDatabase) LibraryLoaderThread(cbit.vcell.resource.LibraryLoaderThread) SlurmProxy(cbit.vcell.message.server.htc.slurm.SlurmProxy) VCMessagingException(cbit.vcell.message.VCMessagingException) Date(java.util.Date) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) BatchSystemType(cbit.vcell.server.HtcJobID.BatchSystemType) File(java.io.File) CommandServiceSshNative(cbit.vcell.message.server.cmd.CommandServiceSshNative)

Example 4 with ServiceInstanceStatus

use of cbit.vcell.message.server.ServiceInstanceStatus in project vcell by virtualcell.

the class DatabaseServer method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    if (args.length < 1) {
        System.out.println("Missing arguments: " + DatabaseServer.class.getName() + " serviceOrdinal [logdir]");
        System.exit(1);
    }
    try {
        PropertyLoader.loadProperties();
        DatabasePolicySQL.lg.setLevel(Level.ALL);
        int serviceOrdinal = Integer.parseInt(args[0]);
        String logdir = null;
        if (args.length > 1) {
            logdir = args[1];
        }
        ServiceInstanceStatus serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DB, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
        VCMongoMessage.serviceStartup(ServiceName.database, new Integer(serviceOrdinal), args);
        // 
        // JMX registration
        // 
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
        ConnectionFactory conFactory = DatabaseService.getInstance().createConnectionFactory();
        KeyFactory keyFactory = conFactory.getKeyFactory();
        DatabaseServerImpl databaseServerImpl = new DatabaseServerImpl(conFactory, keyFactory);
        VCMessagingService vcMessagingService = VCellServiceHelper.getInstance().loadService(VCMessagingService.class);
        vcMessagingService.setDelegate(new ServerMessagingDelegate());
        DatabaseServer databaseServer = new DatabaseServer(serviceInstanceStatus, databaseServerImpl, vcMessagingService, false);
        databaseServer.init();
    } catch (Throwable e) {
        e.printStackTrace(System.out);
    }
}
Also used : ServerMessagingDelegate(cbit.vcell.message.server.ServerMessagingDelegate) VCMessagingService(cbit.vcell.message.VCMessagingService) Date(java.util.Date) ObjectName(javax.management.ObjectName) ConnectionFactory(org.vcell.db.ConnectionFactory) VCellServiceMXBeanImpl(cbit.vcell.message.server.jmx.VCellServiceMXBeanImpl) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DatabaseServerImpl(cbit.vcell.modeldb.DatabaseServerImpl) KeyFactory(org.vcell.db.KeyFactory) MBeanServer(javax.management.MBeanServer)

Example 5 with ServiceInstanceStatus

use of cbit.vcell.message.server.ServiceInstanceStatus in project vcell by virtualcell.

the class SimDataServer method main.

/**
 * Starts the application.
 * @param args an array of command-line arguments
 */
public static void main(java.lang.String[] args) {
    if (args.length < 1) {
        System.out.println("Missing arguments: " + SimDataServer.class.getName() + " serviceOrdinal [EXPORTONLY] [logdir]");
        System.exit(1);
    }
    try {
        PropertyLoader.loadProperties();
        int serviceOrdinal = Integer.parseInt(args[0]);
        String logdir = null;
        boolean bExportOnly = false;
        if (args.length > 1) {
            if (args[1].equalsIgnoreCase("EXPORTONLY")) {
                bExportOnly = true;
                VCMongoMessage.serviceStartup(ServiceName.export, new Integer(serviceOrdinal), args);
                if (args.length > 2) {
                    logdir = args[2];
                }
            } else {
                VCMongoMessage.serviceStartup(ServiceName.simData, new Integer(serviceOrdinal), args);
                logdir = args[1];
            }
        }
        ServiceInstanceStatus serviceInstanceStatus = null;
        ServiceName serviceName = null;
        if (bExportOnly) {
            serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DATAEXPORT, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
            serviceName = ServiceName.export;
        } else {
            serviceInstanceStatus = new ServiceInstanceStatus(VCellServerID.getSystemServerID(), ServiceType.DATA, serviceOrdinal, ManageUtils.getHostName(), new Date(), true);
            serviceName = ServiceName.simData;
        }
        VCMongoMessage.serviceStartup(serviceName, new Integer(serviceOrdinal), args);
        // 
        // JMX registration
        // 
        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
        mbs.registerMBean(new VCellServiceMXBeanImpl(), new ObjectName(VCellServiceMXBean.jmxObjectName));
        Cachetable cacheTable = new Cachetable(MessageConstants.MINUTE_IN_MS * 20);
        DataSetControllerImpl dataSetControllerImpl = new DataSetControllerImpl(cacheTable, new File(PropertyLoader.getRequiredProperty(PropertyLoader.primarySimDataDirInternalProperty)), new File(PropertyLoader.getRequiredProperty(PropertyLoader.secondarySimDataDirInternalProperty)));
        ExportServiceImpl exportServiceImpl = new ExportServiceImpl();
        DataServerImpl dataServerImpl = new DataServerImpl(dataSetControllerImpl, exportServiceImpl);
        VCMessagingService vcMessagingService = VCellServiceHelper.getInstance().loadService(VCMessagingService.class);
        vcMessagingService.setDelegate(new ServerMessagingDelegate());
        SimDataServer simDataServer = new SimDataServer(serviceInstanceStatus, dataServerImpl, vcMessagingService, false);
        // add dataJobListener
        dataSetControllerImpl.addDataJobListener(simDataServer);
        // add export listener
        exportServiceImpl.addExportListener(simDataServer);
        simDataServer.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) VCMessagingService(cbit.vcell.message.VCMessagingService) Date(java.util.Date) ObjectName(javax.management.ObjectName) ServiceName(cbit.vcell.mongodb.VCMongoMessage.ServiceName) VCellServiceMXBeanImpl(cbit.vcell.message.server.jmx.VCellServiceMXBeanImpl) ServiceInstanceStatus(cbit.vcell.message.server.ServiceInstanceStatus) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) ExportServiceImpl(cbit.vcell.export.server.ExportServiceImpl) File(java.io.File) MBeanServer(javax.management.MBeanServer)

Aggregations

ServiceInstanceStatus (cbit.vcell.message.server.ServiceInstanceStatus)7 Date (java.util.Date)4 VCMessagingService (cbit.vcell.message.VCMessagingService)3 ServerMessagingDelegate (cbit.vcell.message.server.ServerMessagingDelegate)3 ExportServiceImpl (cbit.vcell.export.server.ExportServiceImpl)2 VCellServiceMXBeanImpl (cbit.vcell.message.server.jmx.VCellServiceMXBeanImpl)2 DatabaseServerImpl (cbit.vcell.modeldb.DatabaseServerImpl)2 Cachetable (cbit.vcell.simdata.Cachetable)2 DataServerImpl (cbit.vcell.simdata.DataServerImpl)2 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)2 File (java.io.File)2 MBeanServer (javax.management.MBeanServer)2 ObjectName (javax.management.ObjectName)2 ConnectionFactory (org.vcell.db.ConnectionFactory)2 KeyFactory (org.vcell.db.KeyFactory)2 VCMessagingException (cbit.vcell.message.VCMessagingException)1 ServiceSpec (cbit.vcell.message.server.ServiceSpec)1 CommandService (cbit.vcell.message.server.cmd.CommandService)1 CommandServiceLocal (cbit.vcell.message.server.cmd.CommandServiceLocal)1 CommandServiceSshNative (cbit.vcell.message.server.cmd.CommandServiceSshNative)1