healthy.py 文件源码

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

项目:solr-zkutil 作者: bendemott 项目源码 文件源码
def check_queue_sizes(zk_client, threshold=5):
    """
    For the most part queues should be empty.  If they contain more than a given number of 
    entries, return information.

    :param threshold: ``int`` the max number of children a queue can contain before an error is raised.
    """

    errors = []
    stats = get_znode_children_counts(zk_client, ZK_QUEUE_PATHS)
    missing = set(stats.keys()) ^ set(ZK_QUEUE_PATHS)
    for path in missing:
        errors.append("queue path [%s] is missing" % path)

    if stats is None:
        raise ValueError("stats is None!!!")
    for path, max_children in six.viewitems(stats):
        if max_children > threshold:
            errors.append(
                "queue [%s] is backed up with: %d children, error threshold: %d" % (path, max_children, threshold)
            )

    return errors
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号