Это функция, которая выполняет спавны. пул:
Код: Выделить всё
def do_learning_experiments(model, alphabet, correct_size, prot):
"""
Perform the learning experiments for the given model and alphabet.
Args:
model: model to learn
alphabet: input alphabet
correct_size: correct size of the model
"""
# create a copy of the SUL for each oracle
suls = [AutomatonSUL(model) for _ in range(NUM_ORACLES)]
wpr = WALKS_PER_ROUND[prot]
wl = WALK_LEN[prot]
# initialize the oracles
eq_oracles = [StochasticRandom(alphabet, suls[0], wpr, wl),
StochasticLinear(alphabet, suls[1], wpr, wl),
StochasticSquare(alphabet, suls[2], wpr, wl),
StochasticExponential(alphabet, suls[3], wpr, wl)]
# create the arguments for eache oracle's task
tasks = [(alphabet, sul, oracle, correct_size, i)
for i, (sul, oracle) in enumerate(zip(suls, eq_oracles))]
with mp.Pool(processes=mp.cpu_count()) as pool:
results = pool.starmap(process_oracle, tasks)
return results
Код: Выделить всё
for trial in range(TIMES):
results = do_learning_experiments(model, alphabet, correct_size, prot)
Это заставляет меня думать, что процессы не закрыты должным образом, но я на системном мониторе в любой момент не отображается более 5 активных процессов Python.
Как я могу это исправить или хотя бы отладить?
Подробнее здесь: https://stackoverflow.com/questions/793 ... open-files