diff --git a/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py b/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py index f8a625242f3939602cbb7b8391cd8062e21fe01b..8f2d5fc40993fb36ac4991b2426ffcdaaa979412 100644 --- a/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py +++ b/profiler/advisor/advisor_backend/cluster_advice/slow_link_advice.py @@ -99,11 +99,12 @@ class SlowLinkAdvice(ClusterAdviceBase): avg_bw = round(sum(data_list) / len(data_list), 3) if avg_bw == 0: return - self.bottelneck += f'{link_type}: \n' \ + self.bottelneck += f"""{link_type}: """ \ f'The average is {avg_bw}, ' \ f'while the maximum is {round(max(data_list), 3)}GB/s and ' \ f'the minimum is {round(min(data_list), 3)}GB/s. ' \ - f'the difference is {round(max(data_list) - min(data_list), 3)}GB/s. \n' + f"""the difference is {round(max(data_list) - min(data_list), 3)}GB/s. + """ def output(self): self.output_format_data[self.DATA] = self.rank_bw_dict diff --git a/profiler/advisor/analyzer/overall/overall_summary_analyzer.py b/profiler/advisor/analyzer/overall/overall_summary_analyzer.py index 3ca1494f1518e60c6730def256738f520e6aa08a..0a93d19629d395fb2d0524ed83dc8e68e5ce655e 100644 --- a/profiler/advisor/analyzer/overall/overall_summary_analyzer.py +++ b/profiler/advisor/analyzer/overall/overall_summary_analyzer.py @@ -157,14 +157,18 @@ class OverallSummaryAnalyzer(BaseAnalyzer): if not overall_data: return e2e_time = '%.3f' % sum([data for data in overall_data.values()]) - overall_bottleneck = f"The Model E2E Time is {e2e_time}s.\n" + overall_bottleneck = f"""The Model E2E Time is {e2e_time}s. + """ comparison_bottleneck = "" for time_type, time_value in overall_data.items(): # add subtype time bottleneck - advice = self.advice_map.get(time_type, "") - self.cur_bottleneck[self.time_name_map.get(time_type)] = f"{time_type} is {time_value}s.\n{advice}" + self.cur_bottleneck[self.time_name_map.get(time_type)] = f"""{time_type} is {time_value}s. + """ # add overall bottleneck - overall_bottleneck += f" -- {time_type} is {time_value}s\n" + overall_bottleneck +=f""" + """ + overall_bottleneck += f"""-- {time_type} is {time_value}s + """ if time_type == "Free Time" and self._is_minimal_profiling and self.calculate_ratio(time_value, e2e_time) > 0.1: overall_bottleneck += "percentage of free time exceed the threshold 10%." @@ -176,7 +180,8 @@ class OverallSummaryAnalyzer(BaseAnalyzer): base_duration, _ = self.split_duration_and_num(self.get_time_value(time_type_origin, self._base_data)) if time_value > base_duration: ratio = "{:.2%}".format(self.calculate_ratio(time_value - base_duration, base_duration)) - comparison_bottleneck += f"{time_type} exceeds the benchmark by {ratio}\n" + comparison_bottleneck += f"""{time_type} exceeds the benchmark by {ratio} + """ self.cur_bottleneck["overall_data"] = overall_bottleneck if comparison_bottleneck: self.cur_bottleneck["comparison_result"] = comparison_bottleneck