Use slice assignment instead of list.remove for clearing jobs.
This commit is contained in:
parent
87a3002351
commit
630159768d
1 changed files with 1 additions and 4 deletions
|
@ -32,10 +32,7 @@ class ThreadPool:
|
||||||
This function assumes that job_manager_lock is acquired!!
|
This function assumes that job_manager_lock is acquired!!
|
||||||
You should call clear_done_and_start_jobs instead!
|
You should call clear_done_and_start_jobs instead!
|
||||||
'''
|
'''
|
||||||
for job in list(self.jobs):
|
self.jobs[:] = [j for j in self.jobs if j.status in {PENDING, RUNNING}]
|
||||||
if job.status in {FINISHED, RAISED}:
|
|
||||||
# print('Removing done job', job)
|
|
||||||
self.jobs.remove(job)
|
|
||||||
|
|
||||||
def _start_jobs(self):
|
def _start_jobs(self):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue