WorkerProcess.py 文件源码

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

项目:mlc 作者: valiro21 项目源码 文件源码
def __init__(self, ioloop, channel):
        """
        Initialize the Worker in the main thread.
        :param ioloop: The main tornado ioloop.
        :param channel:  The channel being listened.
        """
        self.jobs = []
        self.ioloop = ioloop  # Main tornado ioloop
        self.channel = channel  # Channel to listen and send messages to
        self.results = []
        self.tasks = 0
        self.running_jobs = []
        self.jobs_futures = []
        self.executor = ThreadPoolExecutor(
            max_workers=self.MAX_BATCH_OPERATIONS)

        self.init_cache()
        self.execute_evaluation_loop()
        # Receive a kick in the nuts when somebody talks
        io_loop.add_handler(conn.fileno(), self.receive(), io_loop.READ)

        # Always listen before talking
        print("Attached database listener")
        self.listen()
        self.talk("work!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号