queue.py 文件源码

python
阅读 74 收藏 0 点赞 0 评论 0

项目:lama 作者: CSE-POST 项目源码 文件源码
def _check_analysis_queue(queue_name, thread_id=0):
        """
        Private static method whose create the queue_name queue as singleton
        """
        # check if connection exists for the thread
        if thread_id not in Queue.connections:
            try:
                Queue.connections[thread_id] = pika.BlockingConnection(
                    pika.ConnectionParameters(Queue.host))
            except pika.exceptions.ConnectionClosed as e:
                logging.error("Error with RMQ server, check it's started.")
                os._exit(1)
            Queue.consumers[thread_id] = True
        # check if channel exists for the thread
        if queue_name not in Queue.channels\
                or Queue.channels[queue_name].is_closed:
            Queue.channels[queue_name] = Queue.connections[thread_id].channel()
            Queue.channels[queue_name].queue_declare(queue=queue_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号