__init__.py 文件源码

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

项目:pycos 作者: pgiri 项目源码 文件源码
def monitor(self, observe):
        """Must be used with 'yield' as 'yield task.monitor(observe)', where
        'observe' is a task which will be monitored by 'task'.  When 'observe'
        is finished (raises StopIteration or terminated due to uncaught
        exception), that exception is sent as a message to 'task' (monitor
        task).

        Monitor can inspect the exception and restart observed task if
        necessary. 'observe' can be a remote task.

        Can also be used on remotely running 'observe' task.
        """
        if observe._location:
            # remote task
            request = _NetRequest('monitor', kwargs={'monitor': self, 'name': observe._name,
                                                     'task': observe._id},
                                  dst=observe._location, timeout=MsgTimeout)
            reply = yield _Peer._sync_reply(request)
        else:
            reply = self._scheduler._monitor(self, observe)
        raise StopIteration(reply)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号