sysinfo.py 文件源码

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

项目:treadmill 作者: Morgan-Stanley 项目源码 文件源码
def _get_docker_node_info(info):
    """Gets the node info specific to docker.
    """
    cpucapacity = int(cpu_count() * 100)
    memcapacity = (psutil.virtual_memory().total * 0.9) // _BYTES_IN_MB

    # TODO: manage disk space a little better
    if os.name == 'nt':
        path = 'C:\\ProgramData\\docker'
    else:
        path = '/var/lib/docker'

    diskfree = disk_usage(path).free // _BYTES_IN_MB

    info.update({
        'memory': '%dM' % memcapacity,
        'disk':  '%dM' % diskfree,
        'cpu': '%d%%' % cpucapacity,
        'up_since': up_since(),
    })

    return info
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号