I'd like to run multiple processes concurrently, but using Process I cannot limit the number of processes at a time, so that my computer becomes unusable for anything else. In my problem I have to run the main_function for all of the data in my_dataset. Here is a short sample of my code, is it possible to limit the number of processes at a time?
from multiprocessing import Process def my_function(my_dataset): processes = [] for data in my_dataset: transformed_data = transform(data) p = Process(target=main_function, args=(data, transformed_data)) p.start() processes.append(p) for p in processes: p.join()