예제 #1
0
def multiplex(sources):
    in_q = queue.Queue()
    consumers = []
    for src in sources:
        t = threading.Thread(target=sendto_queue, args=(src, in_q))
        t.start()
        consumers.append(genfrom_queue(in_q))
    return gen_cat(consumers)
예제 #2
0
def multiplex(sources):
    """ Generate items from multiple generators
    """
    in_q = queue.Queue()
    consumers = []
    for src in sources:
        thr = threading.Thread(target=sendto_queue, args=(src, in_q))
        thr.start()
        consumers.append(genfrom_queue(in_q))
    return gen_cat(consumers)
예제 #3
0
 def run(self):
     self.target(genfrom_queue(self.in_q))
예제 #4
0
def print_r404(log_q):
    log = genfrom_queue(log_q)
    print('genfrom_queue: ', log)
    r404 = (r for r in log if r['status'] == 404)
    for r in r404:
        print(r['host'], r['datetime'], r['request'])
예제 #5
0
 def run(self):
     self.target(genfrom_queue(self.in_q))