From e5620e3c192b9d71daba26f485d1375960008cc1 Mon Sep 17 00:00:00 2001 From: Samuel Omlin Date: Tue, 13 Nov 2018 12:32:24 +0100 Subject: [PATCH 1/3] Modification of the retries-directories --- reframe/core/pipeline.py | 9 +++++---- reframe/core/runtime.py | 16 ++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 9cb8440a62..d0da80bdcf 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -804,12 +804,13 @@ def _setup_paths(self): """Setup the check's dynamic paths.""" self.logger.debug('setting up paths') try: - self._stagedir = rt.runtime().resources.make_stagedir( + resources = rt.runtime().resources + self._stagedir = resources.make_stagedir( self.current_system.name, self._current_partition.name, - self._current_environ.name, self.name) - self._outputdir = rt.runtime().resources.make_outputdir( + self._current_environ.name, self.name + resources.run_suffix()) + self._outputdir = resources.make_outputdir( self.current_system.name, self._current_partition.name, - self._current_environ.name, self.name) + self._current_environ.name, self.name + resources.run_suffix()) except OSError as e: raise PipelineError('failed to set up paths') from e diff --git a/reframe/core/runtime.py b/reframe/core/runtime.py index 64576b519a..ea32b66373 100644 --- a/reframe/core/runtime.py +++ b/reframe/core/runtime.py @@ -113,9 +113,9 @@ def _makedir(self, *dirs, wipeout=False): os.makedirs(ret, exist_ok=True) return ret - def _run_suffix(self): + def run_suffix(self): current_run = runtime().current_run - return '_%s' % current_run if current_run > 0 else '' + return '_retry%s' % current_run if current_run > 0 else '' @property def timestamp(self): @@ -125,21 +125,17 @@ def timestamp(self): def output_prefix(self): """The output prefix directory of ReFrame.""" if self.outputdir is None: - return os.path.join(self.prefix, 'output' + self._run_suffix(), - self.timestamp) + return os.path.join(self.prefix, 'output', self.timestamp) else: - return os.path.join(self.outputdir + self._run_suffix(), - self.timestamp) + return os.path.join(self.outputdir, self.timestamp) @property def stage_prefix(self): """The stage prefix directory of ReFrame.""" if self.stagedir is None: - return os.path.join(self.prefix, 'stage' + self._run_suffix(), - self.timestamp) + return os.path.join(self.prefix, 'stage', self.timestamp) else: - return os.path.join(self.stagedir + self._run_suffix(), - self.timestamp) + return os.path.join(self.stagedir, self.timestamp) @property def perflog_prefix(self): From 617295ad2c44eec82fddf05c6b8f043cab64a7eb Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Sat, 17 Nov 2018 01:10:42 -0600 Subject: [PATCH 2/3] Fine tune impl. for the retries stage directories - The suffix is added by the `HostResources`. - `run_suffix()` was replaced by the more generic `_format_dirs()` function. - The suffix for the retries directories is now `@N`. --- reframe/core/pipeline.py | 4 ++-- reframe/core/runtime.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index d0da80bdcf..cd2022f98e 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -807,10 +807,10 @@ def _setup_paths(self): resources = rt.runtime().resources self._stagedir = resources.make_stagedir( self.current_system.name, self._current_partition.name, - self._current_environ.name, self.name + resources.run_suffix()) + self._current_environ.name, self.name) self._outputdir = resources.make_outputdir( self.current_system.name, self._current_partition.name, - self._current_environ.name, self.name + resources.run_suffix()) + self._current_environ.name, self.name) except OSError as e: raise PipelineError('failed to set up paths') from e diff --git a/reframe/core/runtime.py b/reframe/core/runtime.py index ea32b66373..5373710c40 100644 --- a/reframe/core/runtime.py +++ b/reframe/core/runtime.py @@ -113,9 +113,18 @@ def _makedir(self, *dirs, wipeout=False): os.makedirs(ret, exist_ok=True) return ret - def run_suffix(self): + def _format_dirs(self, *dirs): + try: + last = dirs[-1] + except IndexError: + return dirs + current_run = runtime().current_run - return '_retry%s' % current_run if current_run > 0 else '' + if current_run == 0: + return dirs + + last += '@%s' % current_run + return (*dirs[:-1], last) @property def timestamp(self): @@ -145,10 +154,12 @@ def perflog_prefix(self): return self.perflogdir def make_stagedir(self, *dirs, wipeout=True): - return self._makedir(self.stage_prefix, *dirs, wipeout=wipeout) + return self._makedir(self.stage_prefix, + *self._format_dirs(*dirs), wipeout=wipeout) def make_outputdir(self, *dirs, wipeout=True): - return self._makedir(self.output_prefix, *dirs, wipeout=wipeout) + return self._makedir(self.output_prefix, + *self._format_dirs(*dirs), wipeout=wipeout) class RuntimeContext: From 7060500d87180a98b03686f3071fc6d1d50d52ba Mon Sep 17 00:00:00 2001 From: omlins Date: Mon, 19 Nov 2018 10:27:12 +0100 Subject: [PATCH 3/3] Modification of the retry dir suffix --- reframe/core/runtime.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reframe/core/runtime.py b/reframe/core/runtime.py index 5373710c40..13406bbd70 100644 --- a/reframe/core/runtime.py +++ b/reframe/core/runtime.py @@ -123,7 +123,7 @@ def _format_dirs(self, *dirs): if current_run == 0: return dirs - last += '@%s' % current_run + last += '_retry%s' % current_run return (*dirs[:-1], last) @property