0
I have a size 30 list in python, I need to make a loop to catch 6 item from that run list, after we finish the 6 run over 6 and so on until finalizing the list.
but I’m not finding a way to do that.
import os
scripts[
'exp1.py'
'exp2.py'
'exp3.py'
'exp4.py'
[...]
'exp30.py'
]
def roda_processo(processo):
os.system('python {}'.format(processo))
execute:
from multiprocessing import Pool
from scripts import *
if __name__ == '__main__':
num_processors = #[preciso que a execução ocorra aqui 6 em 6]
pool = Pool(processes=num_processors)
output = pool.map(roda_processo, processos)
print(output)
Because I need you to only run 6 processes at a time and when you finish one run the other.
I didn’t get it right. The
exp.py
is the bottom code? Where are the 30 elements of the list? You want 6 in 6 because thenum_processors
is 6 or has to be 6 in 6 regardless of thenum_processors
?– Victor Stafusa
I have a list with 30 elements
scripts
need to execute this list of processes 6 in 6, because it has to be 6 in 6 can not run the 30 at a time.– JB_
What does his code do today? And what does he not do? What should he do?
– Woss
today runs all scripts at once. I need to run 6 by 6 and as I finish a two 6 picks up another and runs until I complete all of the list.
– JB_