def start_client(): cli = zerorpc.Client() cli.connect("tcp://%s:%d" % (SRV_ADDR, SRV_PORT)) cli.join(get_addr()) cli.close()
elif self.mode == mode.APP_COUNTER: from tests.app.getcounter import test elif self.mode == mode.APP_GETDESCRIPTION: from tests.app.getdescription import test elif self.mode == mode.APP_GETINST: from tests.app.getinst import test elif self.mode == mode.APP_GETINSTALLEDPACKAGES: from tests.app.getinstalledpackages import test elif self.mode == mode.APP_GETPACKAGESDETAILS: from tests.app.getpackagesdetails import test elif self.mode == mode.APP_GETTOP: from tests.app.gettop import test elif self.mode == mode.APP_GETTOPDETAILS: from tests.app.gettopdetails import test elif self.mode == mode.APP_GETHASPACKAGE: from tests.app.gethaspackage import test elif self.mode == mode.DRV_UPLOAD: from tests.driver.upload import test elif self.mode == mode.DRV_INSTALL: from tests.driver.install import test test() if __name__ == "__main__": max_open_files_soft, max_open_files_hard = resource.getrlimit(resource.RLIMIT_NOFILE) resource.setrlimit(resource.RLIMIT_NOFILE, (4096, max_open_files_hard)) s = zerorpc.Server(Listener()) Thread(target=start_client).start() s.bind("tcp://%s:%d" % (get_addr(), CLI_PORT)) s.run()