def test_zadvanced_hunter_start(): with Hunter(loop=loop, remote=ADDR) as h: h = Hunter(loop=loop, remote=ADDR) t = threading.Thread(target=h.start) t.start() assert t.is_alive() loop.stop() t.join() assert not t.is_alive()
def _init_hunters(self, threads, token): self.logger.info('launching hunters...') for n in range(int(threads)): self.logger.warn(token) t = threading.Thread( target=Hunter(self.context, token=token).start) t.daemon = True t.start()
def _init_hunters(self, threads, token): if int(threads) == 0: return logger.info('launching hunters...') self.hunter_sink_s = self.context.socket(zmq.ROUTER) self.hunter_sink_s.bind(HUNTER_SINK_ADDR) self.hunters_s = self.context.socket(zmq.PUSH) self.hunters_s.bind(HUNTER_ADDR) self.hunters = [] for n in range(int(threads)): p = mp.Process(target=Hunter(token=token).start) p.start() self.hunters.append(p)
def _init_hunters(self, threads, token): self.logger.info('launching hunters...') for n in range(int(threads)): p = mp.Process(target=Hunter(token=token).start) p.start()
def test_hunter(): from cif.hunter import Hunter Hunter()
def test_hunter(): with Hunter() as h: assert isinstance(h, Hunter)
def test_hunter(): with Hunter(Context.instance()) as h: assert isinstance(h, Hunter)