From 560ec29ffc6d000bfdddd28af769385ffb9ff4b6 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 13 Oct 2022 13:17:01 +0200 Subject: [PATCH 1/3] Get performance info from within the changedir --- reframe/frontend/executors/policies.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reframe/frontend/executors/policies.py b/reframe/frontend/executors/policies.py index e0a5a7cbe8..5a3e6d2b32 100644 --- a/reframe/frontend/executors/policies.py +++ b/reframe/frontend/executors/policies.py @@ -19,6 +19,7 @@ RunOnlyRegressionTest) from reframe.frontend.executors import (ExecutionPolicy, RegressionTask, TaskEventListener, ABORT_REASONS) +from reframe.utility.osext import change_dir def _get_partition_name(task, phase='run'): @@ -41,14 +42,15 @@ def _cleanup_all(tasks, *args, **kwargs): def _print_perf(task): '''Get performance info of the current task.''' - - perfvars = task.testcase.check.perfvalues - for key, info in perfvars.items(): - name = key.split(':')[-1] - getlogger().info( - f'P: {name}: {info[0]} {info[4]} ' - f'(r:{info[1]}, l:{info[2]}, u:{info[3]})' - ) + + with change_dir(task.testcase.check.stagedir): + perfvars = task.testcase.check.perfvalues + for key, info in perfvars.items(): + name = key.split(':')[-1] + getlogger().info( + f'P: {name}: {info[0]} {info[4]} ' + f'(r:{info[1]}, l:{info[2]}, u:{info[3]})' + ) class _PollController: From 3bee75982c5457f5fc6688470bf6e46d374f409a Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 13 Oct 2022 13:36:07 +0200 Subject: [PATCH 2/3] Handle case of no stagedir --- reframe/frontend/executors/policies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/frontend/executors/policies.py b/reframe/frontend/executors/policies.py index 5a3e6d2b32..cd230f03bb 100644 --- a/reframe/frontend/executors/policies.py +++ b/reframe/frontend/executors/policies.py @@ -43,7 +43,7 @@ def _cleanup_all(tasks, *args, **kwargs): def _print_perf(task): '''Get performance info of the current task.''' - with change_dir(task.testcase.check.stagedir): + with change_dir(task.testcase.check.stagedir or '.'): perfvars = task.testcase.check.perfvalues for key, info in perfvars.items(): name = key.split(':')[-1] From 0f50ddae013fede25f2d8f47cc9ac164b46c3098 Mon Sep 17 00:00:00 2001 From: Theofilos Manitaras Date: Thu, 13 Oct 2022 19:06:42 +0200 Subject: [PATCH 3/3] Address PR comments --- reframe/frontend/executors/policies.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/reframe/frontend/executors/policies.py b/reframe/frontend/executors/policies.py index cd230f03bb..9f25692112 100644 --- a/reframe/frontend/executors/policies.py +++ b/reframe/frontend/executors/policies.py @@ -43,14 +43,15 @@ def _cleanup_all(tasks, *args, **kwargs): def _print_perf(task): '''Get performance info of the current task.''' - with change_dir(task.testcase.check.stagedir or '.'): - perfvars = task.testcase.check.perfvalues - for key, info in perfvars.items(): - name = key.split(':')[-1] - getlogger().info( - f'P: {name}: {info[0]} {info[4]} ' - f'(r:{info[1]}, l:{info[2]}, u:{info[3]})' - ) + perfvars = task.testcase.check.perfvalues + if perfvars: + with change_dir(task.testcase.check.stagedir): + for key, info in perfvars.items(): + name = key.split(':')[-1] + getlogger().info( + f'P: {name}: {info[0]} {info[4]} ' + f'(r:{info[1]}, l:{info[2]}, u:{info[3]})' + ) class _PollController: