def start_server(sg, wf, args): # # Instantiate a still server instance # if args.data_dir: mydata_dir = args.data_dir else: mydata_dir = sg.data_dir if args.port: my_port = int(args.port) else: my_port = sg.port sg.logger = setup_logger("TS", "DEBUG", sg.log_path) sg.preflight_check_ts(wf) task_server = TaskServer(sg.dbi, sg, data_dir=mydata_dir, port=my_port, path_to_do_scripts=sg.path_to_do_scripts, drmaa_shared=sg.drmaa_shared) task_server.start() return
def main(): parser = _install_args() args = parser.parse_args() _append_library() _init_logging(args.loglevel) # 2. start rpc server, get fetch name task_server = TaskServer(args.dbaddr, args.scheduler) gprc_server = grpc.server(futures.ThreadPoolExecutor(max_workers=2)) add_TaskInterfaceServicer_to_server(task_server, gprc_server) gprc_server.add_insecure_port(args.addr) gprc_server.start() # 3. logger.info("start server at %s" % args.addr) while True: time.sleep(2)
"stop", "/kill", "kill", "/stats", "stats", ) self.app = WebApplication(urls, globals()) def run(self): try: self.app.run(address=self.address, port=self.port) finally: server.kill() def get_host(self): return "%s:%d" % (self.address, self.port) def stop(self): self.app.stop() # sys.exit() # TODO: sys.argv[2] - task id! if __name__ == "__main__": port = int(sys.argv[1]) task_id = sys.argv[2] manager_address = sys.argv[3] address = sys.argv[4] server = TaskServer(WebServer(port=port, address=address), task_id, manager_address) server.start()