def initialize(cls, is_master): FileBroadcast.initialize(is_master) def run(): sock = env.ctx.socket(zmq.REP) sock.setsockopt(zmq.LINGER, 0) port = sock.bind_to_random_port("tcp://0.0.0.0") cls.master_addr = 'tcp://%s:%d' % (cls.host, port) logger.debug("TreeBroadcast tracker started at %s", cls.master_addr) while True: uuid = sock.recv_pyobj() guide = cls.guides.get(uuid, '') if not guide: logger.warning("broadcast %s is not registered", uuid) sock.send_pyobj(guide) sock.close() logger.debug("TreeBroadcast tracker stopped") if is_master: t = threading.Thread(target=run) t.daemon = True t.start() while cls.master_addr is None: time.sleep(0.01) env.register('TreeBroadcastTrackerAddr', cls.master_addr) else: cls.master_addr = env.get('TreeBroadcastTrackerAddr') logger.debug("TreeBroadcast initialized")
def __init__(self, isMaster): LocalMapOutputTracker.__init__(self, isMaster) if isMaster: self.server = MapOutputTrackerServer(self.serverUris) self.server.start() addr = self.server.addr env.register('MapOutputTrackerAddr', addr) else: addr = env.get('MapOutputTrackerAddr') self.client = MapOutputTrackerClient(addr) logger.debug("MapOutputTracker started")
def __init__(self, isMaster, addr=None): self.isMaster = isMaster self.serverUris = {} self.fetching = set() self.generation = 0 if isMaster: self.server = MapOutputTrackerServer(self.serverUris) self.server.start() addr = self.server.addr env.register('MapOutputTrackerAddr', addr) else: addr = env.get('MapOutputTrackerAddr') self.client = MapOutputTrackerClient(addr) logger.debug("MapOutputTracker started")
def __init__(self, isMaster): LocalCacheTracker.__init__(self, isMaster) if isMaster: self.cache = Cache() else: self.cache = LocalCache(mmapCache).newKeySpace() if isMaster: self.server = CacheTrackerServer(self.locs) self.server.start() addr = self.server.addr env.register("CacheTrackerAddr", addr) else: addr = env.get("CacheTrackerAddr") self.client = CacheTrackerClient(addr)
def __init__(self, isMaster): LocalCacheTracker.__init__(self, isMaster) if isMaster: self.cache = Cache() else: self.cache = LocalCache(mmapCache).newKeySpace() if isMaster: self.server = CacheTrackerServer(self.locs) self.server.start() addr = self.server.addr env.register('CacheTrackerAddr', addr) else: addr = env.get('CacheTrackerAddr') self.client = CacheTrackerClient(addr)
def __init__(self, isMaster): self.isMaster = isMaster self.registeredRddIds = set() if isMaster: self.cache = Cache() else: self.cache = Cache() #LocalCache(mmapCache).newKeySpace() if isMaster: self.server = CacheTrackerServer() self.server.start() addr = self.server.addr env.register('CacheTrackerAddr', addr) else: addr = env.get('CacheTrackerAddr') self.client = CacheTrackerClient(addr)