__init__.py 文件源码

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

项目:pycos 作者: pgiri 项目源码 文件源码
def deliver(self, message, timeout=None):
        """Must be used with 'yield' as 'yield task.deliver(message)'.

        Can also be used on remotely running tasks.

        Return value indicates status of delivering the message: If it is 1,
        then message has been delivered, if it is 0, it couldn't be delivered
        before timeout, and if it is < 0, then the (remote) task is not valid.
        """
        if self._location:
            request = _NetRequest('deliver', kwargs={'message': message, 'name': self._name,
                                                     'task': self._id},
                                  dst=self._location, timeout=timeout)
            request.reply = -1
            reply = yield _Peer._sync_reply(request, alarm_value=0)
            if reply is None:
                reply = -1
            # if reply < 0:
            #     logger.warning('remote task at %s may not be valid', self._location)
        else:
            reply = self._scheduler._resume(self, message, Pycos._AwaitMsg_)
            if reply == 0:
                reply = 1
        raise StopIteration(reply)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号