Run the DbServer on the given database file and port. If not given,
    use the settings in openquake.cfg.
340752
def run_server(dbpath=os.path.expanduser(config.dbserver.file),
               dbhostport=None, loglevel='WARN'):
    
    if dbhostport:  # assume a string of the form "dbhost:port"
        dbhost, port = dbhostport.split(':')
        addr = (dbhost, int(port))
    else:
        addr = (config.dbserver.listen, DBSERVER_PORT)

    # create the db directory if needed
    dirname = os.path.dirname(dbpath)
    if not os.path.exists(dirname):
        os.makedirs(dirname)

    # create and upgrade the db if needed
    db('PRAGMA foreign_keys = ON')  # honor ON DELETE CASCADE
    actions.upgrade_db(db)
    # the line below is needed to work around a very subtle bug of sqlite;
    # we need new connections, see https://github.com/gem/oq-engine/pull/3002
    db.close()

    # reset any computation left in the 'executing' state
    actions.reset_is_running(db)

    # configure logging and start the server
    logging.basicConfig(level=getattr(logging, loglevel))
    DbServer(db, addr).start()
1256581
def run():
    """"""
    parser = OptionParser(version='%prog {0}'.format(__version__))
    parser.add_option('-a', '--addr', default='localhost',
                      help=('The address or host to listen on. Specify -a '
                            '0.0.0.0 to listen on all addresses. '
                            'Default: localhost'))
    parser.add_option('-p', '--port', type='int', default='10101',
                      help=('The port to listen for requests on. '
                            'Default: 10101'))
    options, _ = parser.parse_args()
    try:
        server = ThreadingTCPServer((options.addr, options.port),
                                    RequestHandler)
    except (socket.error, socket.gaierror) as exc:  # Handle bind errors
        print(exc)
        sys.exit(1)
    print('Listening on {0} port {1}'.format(options.addr, options.port))
    try:
        server.serve_forever()  # pylint: disable=E1101
    except KeyboardInterrupt:
        server.socket.close()  # pylint: disable=E1101
        RequestHandler.http.close()
        print('Goodbye!')
1300566
def run(app, appbuilder, host, port, debug):
    
    _appbuilder = import_application(app, appbuilder)
    _appbuilder.get_app.run(host=host, port=port, debug=debug)
1195326
public Database set_db_obj(final String host, final String port) throws DevFailed {
	return change_db_obj(host, port);
    }
99060
public void run() {
        try {
            mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost());
        } catch (Exception e) {
            Log.w(LOG_TAG, "Starting ServerSocket error: ", e);
        }

        while (mServer != null && Thread.currentThread() == mThread) {
            // Any uncaught exception will crash the system process
            try {
                Socket client = mServer.accept();
                if (mThreadPool != null) {
                    mThreadPool.submit(new ViewServerWorker(client));
                } else {
                    try {
                        client.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            } catch (Exception e) {
                Log.w(LOG_TAG, "Connection error: ", e);
            }
        }
    }
175033
def run(self):
        
        server_address = (self.host, self.port)
        threading = True
        if threading:
            httpd_cls = type('WSGIServer', (ThreadingMixIn, WSGIServer), {})
        else:
            httpd_cls = WSGIServer
        self.httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=False)
        wsgi_handler = get_internal_wsgi_application()
        self.httpd.set_app(wsgi_handler)
        self.is_ready.set()
        self.httpd.serve_forever()
23865
def run(self):
        
        self.configure()
        self.setup()
        self.update_dir()
        db.init_db(drop_all=True)
        self.out.log("Starting up the server...")
        config = get_config()
        with HerokuLocalWrapper(config, self.out, verbose=self.verbose) as wrapper:
            try:
                self.execute(wrapper)
            except KeyboardInterrupt:
                pass
            finally:
                os.chdir(self.original_dir)
                self.cleanup()
715936
def run(self, **kwargs):
        

        try:
            loop = IOLoop()
            app = self.make_app()
            app.listen(self.port)
            loop.start()

        except socket.error as serr:
            # Re raise the socket error if not "[Errno 98] Address already in use"
            if serr.errno != errno.EADDRINUSE:
                raise serr
            else:
                logger.warning('The webserver port {} is already used. May be the HttpRobotServer is already running or another software is using this port.'.format(self.port))
491253
public function run()
    {
        $port = (int) $this->arg->options('--port', 5000);

        $hostname = $this->arg->options('--host', 'localhost');

        $settings = $this->arg->options('--php-settings', false);

        if (is_bool($settings)) {
            $settings = '';
        } else {
            $settings = '-d '.$settings;
        }

        // resource.
        $writing_stream = fopen("php://stdout", "w");

        $message = sprintf(
            "[%s] Server start at http://%s:%s \033[0;31;7mCTRL-C for shutdown it\033[00m\n",
            date('F d Y H:i:s a'),
            $hostname,
            $port
        );

        fwrite($writing_stream, $message);

        // Close Open stream
        fclose($writing_stream);

        $filename = $this->setting->getServerFilename();
        $public_directory = $this->setting->getPublicDirectory();

        // Launch the dev server.
        shell_exec(
            "php -S $hostname:$port -t {$public_directory} ".$filename." $settings"
        );
    }
611677
private void makeSureServerIsRunning(PortFile portFile)
            throws IOException, InterruptedException {

        if (portFile.exists()) {
            portFile.lock();
            portFile.getValues();
            portFile.unlock();

            if (portFile.containsPortInfo()) {
                // Server seems to already be running
                return;
            }
        }

        // Fork a new server and wait for it to start
        SjavacClient.fork(sjavacForkCmd,
                          portFile,
                          poolsize,
                          keepalive);
    }
63809
private void startDbServer() {
        final String mode = Config.getInstance().getProperty(Config.AlpineKey.DATABASE_MODE);
        final int port = Config.getInstance().getPropertyAsInt(Config.AlpineKey.DATABASE_PORT);

        if (StringUtils.isEmpty(mode) || !("server".equals(mode) || "embedded".equals(mode) || "external".equals(mode))) {
            LOGGER.error("Database mode not specified. Expected values are 'server', 'embedded', or 'external'");
        }

        if (dbServer != null || "embedded".equals(mode) || "external".equals(mode)) {
            return;
        }
        final String[] args = new String[] {
                "-tcp",
                "-tcpPort", String.valueOf(port),
                "-tcpAllowOthers",
        };
        try {
            LOGGER.info("Attempting to start database service");
            dbServer = Server.createTcpServer(args).start();
            LOGGER.info("Database service started");
        } catch (SQLException e) {
            LOGGER.error("Unable to start database service: " + e.getMessage());
            stopDbServer();
        }
    }
166971
@Override
	public void run()
	{
		try
		{
			String serverHost = InetUtils.resolveAutoInterfaceAddress(settings.getStringProperty(FFMQJMXConsoleSettings.SERVER_HOST, "localhost"));
			int serverPort = settings.getIntProperty(FFMQJMXConsoleSettings.SERVER_PORT, 10003);

			String serviceUrl = "service:jmx:rmi://"+serverHost+"/jndi/rmi://"+serverHost+":"+serverPort+"/jmxconnector-FFMQ-server";
			out.println("JMX Service URL : "+serviceUrl);
			this.jmxServiceURL = new JMXServiceURL(serviceUrl);

			printServerVersion();
			
			boolean interactive = settings.getBooleanProperty(FFMQJMXConsoleSettings.INTERACTIVE, false);
			if (interactive)
				interactiveMode();
			else
			{
				String command = settings.getStringProperty(FFMQJMXConsoleSettings.COMMAND, "help");
				processCommand(command);
			}
		}
		catch (Exception e)
		{
			closeJMXResources();
			handleException(e);
		}
	}
483845
def run(port, like, use_json, server):
    """"""
    if not port and not server[0]:
        raise click.UsageError("Please specify a port")

    if server[0]:
        app.run(host=server[0], port=server[1])
        return

    ports = get_ports(port, like)
    if not ports:
        sys.stderr.write("No ports found for '{0}'\n".format(port))
        return

    if use_json:
        print(json.dumps(ports, indent=4))
    else:
        table = get_table(ports)
        print(table)
15017
def serve(application, host='127.0.0.1', port=8080):
	
	
	# Instantiate the server with a host/port configuration and our application.
	WSGIApplication(application, port=int(port), iface=host).run()
142508
def run_command(self, config_file):
        
        config = configparser.ConfigParser()

        config.read(config_file)

        rdbms = config.get('database', 'rdbms').lower()
        label_regex = config.get('constants', 'label_regex')

        constants = self.create_constants(rdbms)
        constants.main(config_file, label_regex)
438073
def run_sql_script(conn, scriptname='results_md2grid.sql'):
    

    script_dir = os.path.abspath(
        os.path.join(os.path.dirname(__file__), 'sql_scripts'))
    script_str = open(os.path.join(script_dir, scriptname)).read()
    conn.execution_options(autocommit=True).execute(script_str)

    return
613090
def _setup_db(cls):
        
        uri = cls._app.config.get("DB_URL")
        if uri:
            db.connect__(uri, cls._app)