@@ -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
0 commit comments