def startServer(port, stateDir, lucenePort, gatewayPort, quickCommit=False, **kwargs): setSignalHandlers() print 'Firing up API Server.' reactor = Reactor() statePath = abspath(stateDir) dna = main(reactor=reactor, port=port, statePath=statePath, lucenePort=lucenePort, gatewayPort=gatewayPort, quickCommit=quickCommit, **kwargs) server = be(dna) consume(server.once.observer_init()) registerShutdownHandler(statePath=statePath, server=server, reactor=reactor, shutdownMustSucceed=False) print "Ready to rumble at %s" % port sys.stdout.flush() reactor.loop()
def startServer(port, stateDir, luceneserverPort, gatewayPort, quickCommit=False, **ignored): setSignalHandlers() print 'Firing up Index Server.' statePath = abspath(stateDir) writerReactor = Reactor() writer = writerMain( writerReactor=writerReactor, statePath=statePath, luceneserverPort=luceneserverPort, gatewayPort=gatewayPort, quickCommit=quickCommit, ) writerServer = be(writer) # Start writer in main (this) thread: consume(writerServer.once.observer_init()) registerShutdownHandler(statePath=statePath, server=writerServer, reactor=writerReactor, shutdownMustSucceed=False) print "Ready to rumble at port %s" % port stdout.flush() writerReactor.loop()
def startServer(configFile, stateDir): setSignalHandlers() statePath = abspath(stateDir) config = readConfig(configFile) reactor = Reactor() server = be(dna(reactor=reactor, config=config, statePath=statePath)) consume(server.once.observer_init()) registerShutdownHandler(statePath=statePath, server=server, reactor=reactor) print "Server listening on port", config['erfgeoEnrich.portNumber'] print " - local state:", statePath stdout.flush() reactor.loop()
def startServer(stateDir, **kwargs): setSignalHandlers() print 'Firing up Meresco Lucene Server.' reactor = Reactor() databasePath = realpath(abspath(stateDir)) #main dna = main(reactor, databasePath=databasePath, **kwargs) #/main server = be(dna) list(compose(server.once.observer_init())) print "Ready to rumble" stdout.flush() reactor.loop()
def startServer(port, dataDir, dataDirFirst=None, dataDirLast=None, batchSize=None): batchSize = batchSize or DEFAULT_BATCH_SIZE setSignalHandlers() tempDir = mkdtemp(prefix='mockoai-') storage = DataStorage() try: reactor = Reactor() oaiPmh = prepareOaiPmh(dataDirs=[d for d in [dataDirFirst, dataDir, dataDirLast] if d], tempDir=tempDir, storage=storage, batchSize=batchSize) server = be(dna(reactor, port, oaiPmh, storage)) print 'Ready to rumble the mock plein server at', port consume(server.once.observer_init()) registerShutdownHandler(statePath=tempDir, server=server, reactor=reactor) stdout.flush() reactor.loop() finally: rmtree(tempDir)
def startServer(port, stateDir, **kwargs): setSignalHandlers() print 'Firing up Meresco Lucene Server.' reactor = Reactor() databasePath = realpath(abspath(stateDir)) #main dna = main(reactor, port=port, databasePath=databasePath) #/main server = be(dna) list(compose(server.once.observer_init())) print "Ready to rumble" stdout.flush() reactor.loop()
def startServer(port, dataDir=None, jsonConfig=None, batchSize=None): batchSize = batchSize or DEFAULT_BATCH_SIZE setSignalHandlers() tempDir = mkdtemp(prefix='mockoai-') config = JsonList.loads(jsonConfig or '[]') if dataDir: config.append({'dirs': dataDir, 'path': '/'}) try: reactor = Reactor() server = be(dna(reactor, port, config=config, tempDir=tempDir, batchSize=batchSize)) print 'Ready to rumble the mock plein server at', port list(compose(server.once.observer_init())) registerShutdownHandler(statePath=tempDir, server=server, reactor=reactor) stdout.flush() reactor.loop() finally: rmtree(tempDir)
def startServer(port, stateDir, **kwargs): setSignalHandlers() print 'Firing up Gateway Server.' statePath = abspath(stateDir) isdir(statePath) or makedirs(statePath) reactor = Reactor() dna = main(reactor=reactor, port=port, statePath=statePath, **kwargs) server = be(dna) consume(server.once.observer_init()) registerShutdownHandler(statePath=statePath, server=server, reactor=reactor, shutdownMustSucceed=False) print 'Ready to rumble at %s' % port stdout.flush() reactor.loop()
def startServer(port, stateDir, **kwargs): setSignalHandlers() print 'Firing up Gateway Server.' statePath=abspath(stateDir) isdir(statePath) or makedirs(statePath) reactor = Reactor() dna = main( reactor=reactor, port=port, statePath=statePath, **kwargs ) server = be(dna) consume(server.once.observer_init()) registerShutdownHandler(statePath=statePath, server=server, reactor=reactor, shutdownMustSucceed=False) print 'Ready to rumble at %s' % port stdout.flush() reactor.loop()
def startServer(port, stateDir, lucenePort, **kwargs): setSignalHandlers() print 'Firing up SRU-slave.' reactor = Reactor() statePath = abspath(stateDir) dna = main( reactor=reactor, port=port, statePath=statePath, lucenePort=lucenePort, **kwargs ) server = be(dna) consume(server.once.observer_init()) registerShutdownHandler(statePath=statePath, server=server, reactor=reactor, shutdownMustSucceed=False) print "Ready to rumble at %s" % port sys.stdout.flush() reactor.loop()
def startServer(port, stateDir, serverPort, gatewayPort, **ignored): setSignalHandlers() print 'Firing up Index Server.' statePath = abspath(stateDir) writerReactor = Reactor() readerReactor = Reactor() reader, writer = writerMain( writerReactor=writerReactor, readerReactor=readerReactor, readerPort=port, statePath=statePath, serverPort=serverPort, gatewayPort=gatewayPort, ) readerServer = be(reader) writerServer = be(writer) def startReader(): LUCENE_VM.attachCurrentThread() consume(readerServer.once.observer_init()) readerReactor.loop() consume(writerServer.once.observer_init()) registerShutdownHandler(statePath=statePath, server=writerServer, reactor=writerReactor, shutdownMustSucceed=False) tReader = Thread(target=startReader) tReader.setDaemon(True) tReader.start() print "Ready to rumble at port %s" % port stdout.flush() writerReactor.loop()