Exemple #1
0
 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
Exemple #2
0
 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
Exemple #3
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()
Exemple #4
0
 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
Exemple #5
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
Exemple #6
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()
Exemple #7
0
Fichier : app.py Projet : tx626/dpm
 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)
Exemple #8
0
Fichier : app.py Projet : tx626/dpm
 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)
Exemple #9
0
def main():
    allocator = Allocator(localhost(), ALLOCATOR_PORT)
    allocator.run()
Exemple #10
0
def main():
    frontend = Frontend()
    frontend.run(localhost(), FRONTEND_PORT)
Exemple #11
0
def main():
    backend = Backend(localhost(), BACKEND_PORT)
    backend.run()
Exemple #12
0
def main():
    inst = Installer(localhost(), INSTALLER_PORT)
    inst.start()
Exemple #13
0
def main():
    backend = Backend(localhost(), BACKEND_PORT)
    backend.run()
Exemple #14
0
def main():
    repo = Repository(localhost(), REPOSITORY_PORT)
    repo.start()
Exemple #15
0
def main():
    allocator = Allocator(localhost(), ALLOCATOR_PORT)
    allocator.run()
Exemple #16
0
def main():
    recorder = Recorder(localhost(), RECORDER_PORT)
    recorder.run()
Exemple #17
0
def main():
    repo = Repository(localhost(), REPOSITORY_PORT)
    repo.start()
Exemple #18
0
def main():
    frontend = Frontend()
    frontend.run(localhost(), FRONTEND_PORT)
Exemple #19
0
 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)
Exemple #20
0
def main():
    recorder = Recorder(localhost(), RECORDER_PORT)
    recorder.run()