I can upload the file at a time:
import urllib.request urls = ['foo.com/bar.gz', 'foobar.com/barfoo.gz', 'bar.com/foo.gz'] for u in urls: urllib.request.urlretrieve(u)
I could try subprocess as such:
import subprocess import os def parallelized_commandline(command, files, max_processes=2): processes = set() for name in files: processes.add(subprocess.Popen([command, name])) if len(processes) >= max_processes: os.wait() processes.difference_update( [p for p in processes if p.poll() is not None])
Is there a way to parallelize urlretrieve without using os.system or subprocess to cheat?
Given that I have to resort to "cheating" at the moment, is subprocess.Popen right way to load data?
When using parallelized_commandline() above, using multi-threaded but not multi-core for wget , is this normal? Is there a way to make it multi-core rather than multi-threaded?
source share