Answer the question
In order to leave comments, you need to log in
How to limit the total number of executions of a multiprocessing script?
The script is run like this:
with Pool(processes=2) as pool:
for proxy in PROXY_HOST:
pool.apply_async(registration, (proxy, groups))
pool.close()
pool.join()
Answer the question
In order to leave comments, you need to log in
You can use Semaphore to control the number of executions.
And by the way, don't close the pool when you use with.
check the result via pool.apply_async(registration, (proxy, groups)).get()
if successful regs >= required amount - break
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question