def __init__(self): self.essay_q = Queue() #queue of incomping essays self.process_q = Queue(cpu_count()) #queue of processes self.out_q = Queue() #outgoing queue with results self.p_dict = {} # essay to processes mapping self.results = {} # essay to results mapping self.pred = instantiate_predict() self.all_procs = [] atexit.register(self.cleanup)
def __init__(self): self.pred = instantiate_predict() logging.basicConfig(filename="./logs/output_%d.log" % os.getpid() , filemode="w", level=logging.INFO) #atexit.register(logging.shutdown()) self.connection = pika.BlockingConnection(pika.ConnectionParameters( host='localhost')) self.channel = self.connection.channel() self.channel.queue_declare(queue='rpc_queue') self.channel.basic_qos(prefetch_count=1) self.channel.basic_consume(self.on_request, queue='rpc_queue') print " [x] Awaiting RPC requests" self.channel.start_consuming()
def __init__(self): self.pred = instantiate_predict() logging.basicConfig(filename="./logs/output_%d.log" % os.getpid(), filemode="w", level=logging.INFO) #atexit.register(logging.shutdown()) self.connection = pika.BlockingConnection( pika.ConnectionParameters(host='localhost')) self.channel = self.connection.channel() self.channel.queue_declare(queue='rpc_queue') self.channel.basic_qos(prefetch_count=1) self.channel.basic_consume(self.on_request, queue='rpc_queue') print " [x] Awaiting RPC requests" self.channel.start_consuming()