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 __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, addr, port): RPCServer.__init__(self, addr, port, user=User()) self._sandbox = Sandbox() locks = [] for _ in range(LOCK_MAX): locks.append(Lock()) self._locks = HashRing(locks) self._cache = {} if DEBUG: self._register_cnt = 0 self._login_cnt = 0 self._upload_cnt = 0 self._install_cnt = 0 self._uninstall_cnt = 0
def __init__(self, addr, port): RPCServer.__init__(self, addr, port) self._app = App() self._driver = Driver()
def __init__(self, addr, port): RPCServer.__init__(self, addr, port) RecorderServer.__init__(self)