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
评论列表
文章目录