diff --git a/reframe/core/pipeline.py b/reframe/core/pipeline.py index 34f12cda8a..0f7279ca13 100644 --- a/reframe/core/pipeline.py +++ b/reframe/core/pipeline.py @@ -802,10 +802,11 @@ 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._outputdir = resources.make_outputdir( self.current_system.name, self._current_partition.name, self._current_environ.name, self.name) except OSError as e: diff --git a/reframe/core/runtime.py b/reframe/core/runtime.py index 64576b519a..13406bbd70 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 '_%s' % current_run if current_run > 0 else '' + if current_run == 0: + return dirs + + last += '_retry%s' % current_run + return (*dirs[:-1], last) @property def timestamp(self): @@ -125,21 +134,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): @@ -149,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: