Skip to content

Commit 3839bcd

Browse files
authored
Merge pull request #580 from omlins/enhancement/retries_directories
[feat] Update retries stage/output directory naming convention
2 parents d302b99 + f85186f commit 3839bcd

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

reframe/core/pipeline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,10 +802,11 @@ def _setup_paths(self):
802802
"""Setup the check's dynamic paths."""
803803
self.logger.debug('setting up paths')
804804
try:
805-
self._stagedir = rt.runtime().resources.make_stagedir(
805+
resources = rt.runtime().resources
806+
self._stagedir = resources.make_stagedir(
806807
self.current_system.name, self._current_partition.name,
807808
self._current_environ.name, self.name)
808-
self._outputdir = rt.runtime().resources.make_outputdir(
809+
self._outputdir = resources.make_outputdir(
809810
self.current_system.name, self._current_partition.name,
810811
self._current_environ.name, self.name)
811812
except OSError as e:

reframe/core/runtime.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,18 @@ def _makedir(self, *dirs, wipeout=False):
113113
os.makedirs(ret, exist_ok=True)
114114
return ret
115115

116-
def _run_suffix(self):
116+
def _format_dirs(self, *dirs):
117+
try:
118+
last = dirs[-1]
119+
except IndexError:
120+
return dirs
121+
117122
current_run = runtime().current_run
118-
return '_%s' % current_run if current_run > 0 else ''
123+
if current_run == 0:
124+
return dirs
125+
126+
last += '_retry%s' % current_run
127+
return (*dirs[:-1], last)
119128

120129
@property
121130
def timestamp(self):
@@ -125,21 +134,17 @@ def timestamp(self):
125134
def output_prefix(self):
126135
"""The output prefix directory of ReFrame."""
127136
if self.outputdir is None:
128-
return os.path.join(self.prefix, 'output' + self._run_suffix(),
129-
self.timestamp)
137+
return os.path.join(self.prefix, 'output', self.timestamp)
130138
else:
131-
return os.path.join(self.outputdir + self._run_suffix(),
132-
self.timestamp)
139+
return os.path.join(self.outputdir, self.timestamp)
133140

134141
@property
135142
def stage_prefix(self):
136143
"""The stage prefix directory of ReFrame."""
137144
if self.stagedir is None:
138-
return os.path.join(self.prefix, 'stage' + self._run_suffix(),
139-
self.timestamp)
145+
return os.path.join(self.prefix, 'stage', self.timestamp)
140146
else:
141-
return os.path.join(self.stagedir + self._run_suffix(),
142-
self.timestamp)
147+
return os.path.join(self.stagedir, self.timestamp)
143148

144149
@property
145150
def perflog_prefix(self):
@@ -149,10 +154,12 @@ def perflog_prefix(self):
149154
return self.perflogdir
150155

151156
def make_stagedir(self, *dirs, wipeout=True):
152-
return self._makedir(self.stage_prefix, *dirs, wipeout=wipeout)
157+
return self._makedir(self.stage_prefix,
158+
*self._format_dirs(*dirs), wipeout=wipeout)
153159

154160
def make_outputdir(self, *dirs, wipeout=True):
155-
return self._makedir(self.output_prefix, *dirs, wipeout=wipeout)
161+
return self._makedir(self.output_prefix,
162+
*self._format_dirs(*dirs), wipeout=wipeout)
156163

157164

158165
class RuntimeContext:

0 commit comments

Comments
 (0)