From 3a5045ada316bc113182af327f2acfe7de7b831b Mon Sep 17 00:00:00 2001 From: stby Date: Thu, 9 May 2024 15:31:26 +0800 Subject: [PATCH] bugfix analysis_mode --- profiler/cluster_analyse/cluster_analysis.py | 10 +++++++--- profiler/cluster_analyse/common_func/constant.py | 5 +---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/profiler/cluster_analyse/cluster_analysis.py b/profiler/cluster_analyse/cluster_analysis.py index beb582b95..aafb68ac9 100644 --- a/profiler/cluster_analyse/cluster_analysis.py +++ b/profiler/cluster_analyse/cluster_analysis.py @@ -25,6 +25,9 @@ from common_func.path_manager import PathManager from common_func import analysis_loader from analysis.analysis_facade import AnalysisFacade +COMM_FEATURE_LIST = ['all', 'communication_time', 'communication_matrix'] +ALL_FEATURE_LIST = ['all', 'communication_time', 'communication_matrix', 'cann_api_sum'] + def get_analysis_args(analysis_class, analysis_args): parser = argparse.ArgumentParser(description="custom analysis args") @@ -49,6 +52,7 @@ class Interface: ASCEND_PT = "ascend_pt" ASCEND_MS = "ascend_ms" + def __init__(self, params: dict): self.collection_path = PathManager.get_realpath(params.get(Constant.COLLECTION_PATH)) self.analysis_mode = params.get(Constant.ANALYSIS_MODE) @@ -90,7 +94,7 @@ class Interface: if data_type == Constant.INVALID: print("[ERROR] The current folder contains both DB and other files. Please check.") return - if self.analysis_mode == "recipe": + if self.analysis_mode not in COMM_FEATURE_LIST: params = { Constant.COLLECTION_PATH: self.collection_path, Constant.DATA_MAP: data_map, @@ -114,13 +118,13 @@ class Interface: if __name__ == "__main__": parser = argparse.ArgumentParser(description="cluster analysis module") parser.add_argument('-d', '--collection_path', type=str, required=True, help="profiling data path") - parser.add_argument('-m', '--mode', choices=Constant.ALL_FEATURE_LIST, + parser.add_argument('-m', '--mode', choices=ALL_FEATURE_LIST, default='all', help="different analysis mode") args_parsed, args_remained = parser.parse_known_args() parameter = { Constant.COLLECTION_PATH: args_parsed.collection_path, Constant.ANALYSIS_MODE: args_parsed.mode } - if args_parsed.mode not in Constant.COMM_FEATURE_LIST: + if args_parsed.mode not in COMM_FEATURE_LIST: parameter.update(parse_recipe_params(args_parsed.mode, args_remained)) Interface(parameter).run() diff --git a/profiler/cluster_analyse/common_func/constant.py b/profiler/cluster_analyse/common_func/constant.py index 61922f2a3..dfaf02320 100644 --- a/profiler/cluster_analyse/common_func/constant.py +++ b/profiler/cluster_analyse/common_func/constant.py @@ -112,7 +112,4 @@ class Constant(object): CLUSTER_CUSTOM_ANALYSE_PATH = os.path.abspath(os.path.dirname(__file__)) ANALYSIS_PATH = os.path.join(CLUSTER_CUSTOM_ANALYSE_PATH, 'analysis') - CONCURRENT_MODE = "concurrent" - - COMM_FEATURE_LIST = ['all', 'communication_time', 'communication_matrix'] - ALL_FEATURE_LIST = ['all', 'communication_time', 'communication_matrix', 'cann_api_sum'] \ No newline at end of file + CONCURRENT_MODE = "concurrent" \ No newline at end of file -- Gitee