def __init__(self, addr, port): RPCServer.__init__(self, addr, port) len_up = len(UPLOAD_SERVERS) len_repo = len(REPOSITORY_SERVERS) if len_up < len_repo or len_up % len_repo != 0: show_error(self, 'failed to initialize') raise Exception('failed to initialize') addr = localhost() if addr not in REPOSITORY_SERVERS: show_error(self, 'failed to initialize') raise Exception('failed to initialize REPOSITORY_SERVERS') for i in range(len(REPOSITORY_SERVERS)): if addr == REPOSITORY_SERVERS[i]: break total = len_up / len_repo self._upload_servers = UPLOAD_SERVERS[i * total:(i + 1) * total] self._print('upload_servers=%s' % str(self._upload_servers)) if HDFS: self._port = HDFS_PORT self._client = HDFSClient() else: self._port = FTP_PORT self._client = FTPClient() self._server = FTPServer() if REPO_DB: self._db = Database(addr=REPO_DB) else: self._db = Database(addr=addr) locks = [] for _ in range(LOCK_MAX): locks.append(Lock()) self._locks = HashRing(locks) if DEBUG: self._upload_cnt = 0 self._download_cnt = 0
def run(self): if MANAGER_WEBSOCKET: application = tornado.web.Application([(r'/', ManagerWSHandler)]) application.listen(self.port) tornado.ioloop.IOLoop.instance().start() else: s = zerorpc.Server(Manager()) s.bind("tcp://%s:%d" % (localhost(), self.port)) s.run()
def __init__(self, addr, port): RPCServer.__init__(self, addr, port) self._cache = {} if SERVER_ALLOCDB: self._client = MongoClient(SERVER_ALLOCDB[0], MONGO_PORT) else: self._client = MongoClient(localhost(), MONGO_PORT) if DEBUG: self._alloc_cnt = 0
def __init__(self, addr, port): RPCServer.__init__(self, addr, port) self._cache = {} if ALLOC_DB: self._client = MongoClient(ALLOC_DB, MONGO_PORT) else: self._client = MongoClient(localhost(), MONGO_PORT) if DEBUG: self._alloc_cnt = 0
def __init__(self): self._lock = Lock() if APP_DB: self._db = Database(addr=APP_DB, domain=APP) else: self._db = Database(addr=localhost(), domain=APP)
def main(): allocator = Allocator(localhost(), ALLOCATOR_PORT) allocator.run()
def main(): frontend = Frontend() frontend.run(localhost(), FRONTEND_PORT)
def main(): backend = Backend(localhost(), BACKEND_PORT) backend.run()
def main(): inst = Installer(localhost(), INSTALLER_PORT) inst.start()
def main(): repo = Repository(localhost(), REPOSITORY_PORT) repo.start()
def main(): recorder = Recorder(localhost(), RECORDER_PORT) recorder.run()
def __init__(self): self._lock = Lock() if SERVER_APPDB: self._db = Database(addr=SERVER_APPDB[0], domain=APP) else: self._db = Database(addr=localhost(), domain=APP)