worker.py 文件源码

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

项目:cess 作者: frnsys 项目源码 文件源码
def call_agent(self, data):
        """call a method on an agent and get the result"""
        d = {'args': [], 'kwargs': {}}
        d.update(data)
        id = d['id']

        # check locally
        if id in self.agents:
            agent = self.agents[id]
            result = getattr(agent, d['func'])(*d['args'], **d['kwargs'])
            if inspect.isgenerator(result):
                result = yield from result
            return result

        # pass request to the arbiter
        else:
            d['cmd'] = 'call_agent'
            return (yield from self.arbiter.send_recv(d))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号