Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
31 changes: 19 additions & 12 deletions reframe/core/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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:
Expand Down