Use threadpool add_many for creating job batch.
This commit is contained in:
parent
cb9d119482
commit
0a12dd45c0
1 changed files with 5 additions and 4 deletions
|
@ -186,10 +186,11 @@ def download_bigchunk_range(bigchunk_xy1, bigchunk_xy2, threads=1):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
pool = threadpool.ThreadPool(size=threads)
|
pool = threadpool.ThreadPool(size=threads)
|
||||||
jobs = []
|
kwargss = [
|
||||||
for (x, y) in bigchunks:
|
{'function': download_bigchunk, 'args': (x, y), 'name': (x, y),}
|
||||||
job = pool.add(download_bigchunk, args=(x, y), name=(x, y))
|
for (x, y) in bigchunks
|
||||||
jobs.append(job)
|
]
|
||||||
|
jobs = pool.add_many(kwargss)
|
||||||
for job in jobs:
|
for job in jobs:
|
||||||
job.join()
|
job.join()
|
||||||
if job.exception:
|
if job.exception:
|
||||||
|
|
Loading…
Reference in a new issue