Skip to content

Commit b060f8c

Browse files
committed
Remove _remove_from_waiting from task failure
1 parent de5ee3b commit b060f8c

File tree

2 files changed

+18
-34
lines changed

2 files changed

+18
-34
lines changed

reframe/frontend/executors/policies.py

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,6 @@ def _remove_from_running(self, task):
180180
partname = task.check.current_partition.fullname
181181
self._running_tasks_counts[partname] -= 1
182182

183-
def _remove_from_waiting(self, task):
184-
getlogger().debug(
185-
'removing task from waiting list: %s' % task.check.info()
186-
)
187-
try:
188-
self._waiting_tasks.remove(task)
189-
except ValueError:
190-
getlogger().debug('not in waiting tasks')
191-
pass
192-
193183
def deps_failed(self, task):
194184
return any(self._task_index[c].failed for c in task.testcase.deps)
195185

@@ -207,7 +197,6 @@ def on_task_run(self, task):
207197

208198
def on_task_failure(self, task):
209199
self._remove_from_running(task)
210-
self._remove_from_waiting(task)
211200
self.printer.status('FAIL', task.check.info(), just='right')
212201

213202
def on_task_success(self, task):
@@ -224,14 +213,8 @@ def on_task_exit(self, task):
224213
self._completed_tasks.append(task)
225214

226215
def _setup_task(self, task):
227-
try:
228-
if self.deps_failed(task):
229-
exc = TaskDependencyError('dependencies failed')
230-
task.fail((type(exc), exc, None))
231-
return False
232-
elif not self.deps_succeeded(task):
233-
return False
234-
else:
216+
if self.deps_succeeded(task):
217+
try:
235218
task.setup(task.testcase.partition,
236219
task.testcase.environ,
237220
sched_flex_alloc_nodes=self.sched_flex_alloc_nodes,
@@ -241,11 +224,17 @@ def _setup_task(self, task):
241224
sched_nodelist=self.sched_nodelist,
242225
sched_exclude_nodelist=self.sched_exclude_nodelist,
243226
sched_options=self.sched_options)
244-
245-
except TaskExit:
227+
except TaskExit:
228+
return False
229+
else:
230+
return True
231+
elif self.deps_failed(task):
232+
exc = TaskDependencyError('dependencies failed')
233+
task.fail((type(exc), exc, None))
234+
return False
235+
else:
236+
# Not all dependencies have finished yet
246237
return False
247-
248-
return True
249238

250239
def runcase(self, case):
251240
super().runcase(case)
@@ -265,7 +254,7 @@ def runcase(self, case):
265254
)
266255
try:
267256
partname = partition.fullname
268-
if (not self._setup_task(task)):
257+
if not self._setup_task(task):
269258
if not task.failed:
270259
self.printer.status(
271260
'DEP', '%s on %s using %s' %
@@ -320,11 +309,8 @@ def _poll_tasks(self):
320309

321310
def _setup_all(self):
322311
still_waiting = []
323-
# It needs to loop over a copy of _waiting_tasks because a testcase
324-
# could fail on setup and be removed from the list _waiting_tasks.
325-
# This would not be not safe and could have unxpected consequences.
326-
for task in self._waiting_tasks[:]:
327-
if not task.failed and not self._setup_task(task):
312+
for task in self._waiting_tasks:
313+
if not self._setup_task(task) and not task.failed:
328314
still_waiting.append(task)
329315

330316
self._waiting_tasks[:] = still_waiting

unittests/resources/checks_unlisted/deps_complex.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,14 @@ def prepend_output(self, T1):
166166

167167
@rfm.run_after('setup')
168168
def fail(self):
169-
'''Make this test fail on purpose'''
170-
169+
# Make this test fail on purpose
171170
raise Exception
172171

173172

174173
@rfm.simple_test
175174
class T9(BaseTest):
176-
'''This tests fails because of T8. It is added to make sure that
177-
all tests are accounted for in the summary.
178-
'''
175+
# This tests fails because of T8. It is added to make sure that
176+
# all tests are accounted for in the summary.
179177

180178
def __init__(self):
181179
super().__init__()

0 commit comments

Comments
 (0)