From fe720ef319a1b01747480888421903d82aad07c2 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 16 Jan 2020 16:51:38 +0100 Subject: [PATCH 1/3] Fix printing of incomplete perf report * Do not print the performance report table if no performance report values are present. * Put printing of num_tasks in the correct if block. --- reframe/frontend/statistics.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/reframe/frontend/statistics.py b/reframe/frontend/statistics.py index e3e9e8f17f..af91ae0208 100644 --- a/reframe/frontend/statistics.py +++ b/reframe/frontend/statistics.py @@ -112,8 +112,10 @@ def failure_report(self): def performance_report(self): line_width = 78 - report = [line_width * '='] - report.append('PERFORMANCE REPORT') + report_start = line_width * '=' + report_title = 'PERFORMANCE REPORT' + report_end = line_width * '_' + report = [] previous_name = '' previous_part = '' for t in self.tasks(): @@ -128,8 +130,7 @@ def performance_report(self): previous_part = t.check.current_partition.fullname report.append(' - %s' % t.check.current_environ) - - report.append(' * num_tasks: %s' % t.check.num_tasks) + report.append(' * num_tasks: %s' % t.check.num_tasks) for key, ref in t.check.perfvalues.items(): var = key.split(':')[-1] @@ -141,5 +142,7 @@ def performance_report(self): report.append(' * %s: %s %s' % (var, val, unit)) - report.append(line_width * '-') - return '\n'.join(report) + if report: + return '\n'.join([report_start, report_title, *report, report_end]) + + return '' From e21faff7039412ce795f89db525b80c963157a94 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 17 Jan 2020 14:06:00 +0100 Subject: [PATCH 2/3] Address PR comments --- reframe/frontend/statistics.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reframe/frontend/statistics.py b/reframe/frontend/statistics.py index af91ae0208..2f59045488 100644 --- a/reframe/frontend/statistics.py +++ b/reframe/frontend/statistics.py @@ -115,22 +115,23 @@ def performance_report(self): report_start = line_width * '=' report_title = 'PERFORMANCE REPORT' report_end = line_width * '_' - report = [] + report_body = [] previous_name = '' previous_part = '' for t in self.tasks(): if t.check.perfvalues.keys(): if t.check.name != previous_name: - report.append(line_width * '-') - report.append('%s' % t.check.name) + report_body.append(line_width * '-') + report_body.append('%s' % t.check.name) previous_name = t.check.name if t.check.current_partition.fullname != previous_part: - report.append('- %s' % t.check.current_partition.fullname) + report_body.append( + '- %s' % t.check.current_partition.fullname) previous_part = t.check.current_partition.fullname - report.append(' - %s' % t.check.current_environ) - report.append(' * num_tasks: %s' % t.check.num_tasks) + report_body.append(' - %s' % t.check.current_environ) + report_body.append(' * num_tasks: %s' % t.check.num_tasks) for key, ref in t.check.perfvalues.items(): var = key.split(':')[-1] @@ -140,9 +141,10 @@ def performance_report(self): except IndexError: unit = '(no unit specified)' - report.append(' * %s: %s %s' % (var, val, unit)) + report_body.append(' * %s: %s %s' % (var, val, unit)) if report: - return '\n'.join([report_start, report_title, *report, report_end]) + return '\n'.join([report_start, report_title, *report_body, + report_end]) return '' From 115f537863e82a7794f32fbb5b7c086b0cd9d4da Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Fri, 17 Jan 2020 14:51:14 +0100 Subject: [PATCH 3/3] Fix variable name --- reframe/frontend/statistics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/frontend/statistics.py b/reframe/frontend/statistics.py index 2f59045488..01e3f2c459 100644 --- a/reframe/frontend/statistics.py +++ b/reframe/frontend/statistics.py @@ -143,7 +143,7 @@ def performance_report(self): report_body.append(' * %s: %s %s' % (var, val, unit)) - if report: + if report_body: return '\n'.join([report_start, report_title, *report_body, report_end])