concurrent.py 文件源码

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

项目:deb-python-cassandra-driver 作者: openstack 项目源码 文件源码
def _execute(self, idx, statement, params):
        self._exec_depth += 1
        try:
            future = self.session.execute_async(statement, params, timeout=None)
            args = (future, idx)
            future.add_callbacks(
                callback=self._on_success, callback_args=args,
                errback=self._on_error, errback_args=args)
        except Exception as exc:
            # exc_info with fail_fast to preserve stack trace info when raising on the client thread
            # (matches previous behavior -- not sure why we wouldn't want stack trace in the other case)
            e = sys.exc_info() if self._fail_fast and six.PY2 else exc

            # If we're not failing fast and all executions are raising, there is a chance of recursing
            # here as subsequent requests are attempted. If we hit this threshold, schedule this result/retry
            # and let the event loop thread return.
            if self._exec_depth < self.max_error_recursion:
                self._put_result(e, idx, False)
            else:
                self.session.submit(self._put_result, e, idx, False)
        self._exec_depth -= 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号