Limiting the number of processes running at a time from a Python script
问题 I'm running a backup script that launches child processes to perform backups by rsync. However I have no way to limit the number of rsyncs it launches at a time. Here's the code I'm working on at the moment: print "active_children: ", multiprocessing.active_children() print "active_children len: ", len(multiprocessing.active_children()) while len(multiprocessing.active_children()) > 49: sleep(2) p = multiprocessing.Process(target=do_backup, args=(shash["NAME"],ip,shash["buTYPE"], )) jobs