healthy.py 文件源码

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

项目:solr-zkutil 作者: bendemott 项目源码 文件源码
def get_async_result_tuples(results):
    """
    Given a dictionary like::

        {
            arg_0: {
                0: result or exception obj
                1: result or exception obj 
                2: result or exception obj 
            },
            arg_1: {
                0: result or exception obj
                1: result or exception obj 
                2: result or exception obj 
            },
        }

    Return a list, composed of tuples of (host, arg, result)
    where arg is the input argument, host is the host index and
    result is the response/result object from the zookeeper api call

    Any results that contain exception objects / errors are ignored.

    :param result: A result set dictionary as returned from ``get_async_call_per_host``
    :returns: ``list``
    """
    if not isinstance(results, dict):
        raise ValueError('"result" must be dict, got: %s' % type(dict))

    items = []

    for arg, host_result in six.viewitems(results):
        items.extend([(host, arg, result) for host, result in six.viewitems(host_result) if not isinstance(result, Exception)])

    return items
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号