Parallel function from joblib running whole code apart from functions

时间:2018-02-26 17:38:47

标签: python parallel-processing joblib

I am using Parallel function from joblib package in Python. I would like to use this function only for handle one of my functions but unfortunately the whole code is running in parallel (apart from other functions).

Example:

from joblib import Parallel, delayed
print ('I do not want this to be printed n times')
def do_something(arg):
    some calculations(arg)

Parallel(n_jobs=5)(delayed(do_something)(i) for i in range(0, n))

0 个答案:

没有答案