The documentation you are attached to indicates that Parallel has an additional progress bar. It is implemented using the callback keyword argument provided by multiprocessing.Pool.apply_async :
...
class CallBack(object): """ Callback used by parallel: it is used for progress reporting, and to add data to be processed """ def __init__(self, index, parallel): self.parallel = parallel self.index = index def __call__(self, out): self.parallel.print_progress(self.index) if self.parallel._original_iterable: self.parallel.dispatch_next()
And here print_progress :
def print_progress(self, index): elapsed_time = time.time() - self._start_time
The way they implement this looks strange, to be honest - it seems, it is assumed that the tasks will always be completed in the order in which they will be launched. The index variable, which goes to print_progress , is only the self.n_dispatched variable at the time it started. Thus, the first running job always ends with index 0, even if, say, the third job is completed first. This also means that they do not actually track the amount of work performed. So there is no instance variable for you.
I think it is best to make your own CallBack class and the Parallel monkey patch:
from math import sqrt from collections import defaultdict from joblib import Parallel, delayed class CallBack(object): completed = defaultdict(int) def __init__(self, index, parallel): self.index = index self.parallel = parallel def __call__(self, index): CallBack.completed[self.parallel] += 1 print("done with {}".format(CallBack.completed[self.parallel])) if self.parallel._original_iterable: self.parallel.dispatch_next() import joblib.parallel joblib.parallel.CallBack = CallBack if __name__ == "__main__": print(Parallel(n_jobs=2)(delayed(sqrt)(i**2) for i in range(10)))
Output:
done with 1 done with 2 done with 3 done with 4 done with 5 done with 6 done with 7 done with 8 done with 9 done with 10 [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
This way, your callback is called whenever the job completes, and not by default.