preflight.py 文件源码

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

项目:cellranger 作者: 10XGenomics 项目源码 文件源码
def check_open_fh():
    _, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
    if 0 <= hard and hard < tk_constants.MIN_PROCESS_NOFILE:
        return False, "On machine: %s, process open file handle hard limit (%d) is less than %d. Please run 'ulimit -n %d' before restarting the pipeline." % (
            socket.gethostname(), hard, tk_constants.MIN_PROCESS_NOFILE, tk_constants.MIN_PROCESS_NOFILE)

    if not os.path.exists(tk_constants.GLOBAL_NOFILE_PATH):
        return False, "On machine: %s, %s does not exist." % (socket.gethostname(), tk_constants.GLOBAL_NOFILE_PATH)
    with open(tk_constants.GLOBAL_NOFILE_PATH) as f:
        glob_str = f.read().strip()
    if not glob_str.isdigit():
        return False, "On machine: %s, %s contains a non-integer global open file handle limit: %s." % (
            socket.gethostname(), tk_constants.GLOBAL_NOFILE_PATH, glob_str)

    glob = int(glob_str)
    if glob < tk_constants.MIN_GLOBAL_NOFILE:
        return False, "On machine: %s, global open file handle limit (%d) is less than %d. Please set the global file handle limit to %d before restarting the pipeline." % (
            socket.gethostname(), glob, tk_constants.MIN_GLOBAL_NOFILE, tk_constants.MIN_GLOBAL_NOFILE)
    return True, None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号