diff --git a/profiler/msprof_analyze/prof_common/file_manager.py b/profiler/msprof_analyze/prof_common/file_manager.py index 064eb3f039aea5d39dd44e8ca84aac45f68019b8..737d1788417cbc1131b86b82144953b6449ead14 100644 --- a/profiler/msprof_analyze/prof_common/file_manager.py +++ b/profiler/msprof_analyze/prof_common/file_manager.py @@ -36,11 +36,10 @@ class FileManager: if file_size <= 0: return result_data if not AdditionalArgsManager().force and file_size > Constant.MAX_FILE_SIZE: - check_msg = input( - f"The file({file_path}) size exceeds the preset max value. Continue reading the file? [y/n]") - if check_msg.lower() != "y": - logger.warning("The user choose not to read the file: %s", file_path) - return result_data + logger.warning(f"The file({file_path}) size is {file_size} Byte, exceeds the preset max value. You can add " + f"the '--force' parameter and retry. This parameter will ignore the file owner and " + f"file size!") + return result_data try: with open(file_path, "r") as json_file: result_data = json.loads(json_file.read()) @@ -57,11 +56,10 @@ class FileManager: if file_size <= 0: return [] if not AdditionalArgsManager().force and file_size > Constant.MAX_FILE_SIZE: - check_msg = input( - f"The file({file_path}) size exceeds the preset max value. Continue reading the file? [y/n]") - if check_msg.lower() != "y": - logger.warning(f"The user choose not to read the file: {file_path}") - return [] + logger.warning(f"The file({file_path}) size is {file_size} Byte, exceeds the preset max value. You can add " + f"the '--force' parameter and retry. This parameter will ignore the file owner and " + f"file size!") + return [] result_data = [] try: with open(file_path, newline="") as csv_file: diff --git a/profiler/msprof_analyze/prof_common/path_manager.py b/profiler/msprof_analyze/prof_common/path_manager.py index 05970362ba2410da3ea281a4fb9a8812c9d1575a..0b92ebc2de1365e2e05a576ed3e471d09da4d238 100644 --- a/profiler/msprof_analyze/prof_common/path_manager.py +++ b/profiler/msprof_analyze/prof_common/path_manager.py @@ -111,10 +111,8 @@ class PathManager: if not os.path.exists(path): continue if os.stat(path).st_uid != os.getuid(): - check_msg = input("The path does not belong to you, do you want to continue? [y/n]") - if check_msg.lower() != "y": - raise RuntimeError("The user choose not to continue.") - return + raise RuntimeError("The path does not belong to you. You can add the '--force' parameter and " + "retry. This parameter will ignore the file owner and file size!") @classmethod def check_path_writeable(cls, path): @@ -211,10 +209,9 @@ class PathManager: return file_size = os.path.getsize(file_path) if file_size > Constant.MAX_FILE_SIZE_5_GB: - check_msg = input( - f"The file({file_path}) size exceeds the preset max value. Continue reading the file? [y/n]") - if check_msg.lower() != "y": - raise RuntimeError(f"[WARNING] The user choose not to read the file: {file_path}") + raise RuntimeError(f"The file({file_path}) size is {file_size} Byte, exceeds the preset max value. " + f"You can add the '--force' parameter and retry. This parameter will ignore " + f"the file owner and file size!") @classmethod def expanduser_for_cli(cls, ctx, parm, str_name: str):