def server(bind=None): e = bind or serviced_endpoint config = { 'endpoint': e } s = QuantServiceD(config) server = zerorpc.Server(s) INFO("bind to %s" % e) server.bind(e) try: serviced.run_service('quant_serviced', e, server.run) except KeyboardInterrupt: INFO("warm shutdown")
def server(bind=None, job_modules=''): import zerorpc job_modules = ['quant_executor'] + job_modules.split(',') config = load_job_config_from_packages(job_modules) worker = Worker(config) s = zerorpc.Server(worker) e = bind or executor_endpoint INFO("quant_executor server bind to %s with job_modules: %s" % (bind, job_modules)) s.bind(e) attr = { 'type': 'zerorpc', 'module': 'quant_executor' } serviced.run_service('quant_executor', e, s.run, attr)
def server(bind=None): e = bind or crawler_endpoint conf = { 'endpoint': e, } s = CrawlerServer(conf) server = zerorpc.Server(s) INFO("bind to %s" % e) server.bind(e) try: attr = { 'type': 'zerorpc', 'module': 'quant_crawler' } serviced.run_service('quant_crawler', e, server.run, attr) except KeyboardInterrupt: INFO("warm shutdown")