joblib

Disable joblib.memory caching globally during unittest

Disable joblib.memory caching globally during unittest Question: I use the joblib.Memory module to cache some functions within several modules. The cache is initialized within modules and classes separately. Module1: memory = Memory(location=’/cache/’) @memory.cache def heavy_function(…) ….. Module2: memory = Memory(location=’/cache/’) @memory.cache def heavy_function2(…) ….. Module3: import Module1 import Module2 def heavy_function3(…) Module1.heavy_function1(…) Module1.heavy_function1(…) ….. Now …

Total answers: 3

What does the delayed() function do (when used with joblib in Python)

What does the delayed() function do (when used with joblib in Python) Question: I’ve read through the documentation, but I don’t understand what is meant by: The delayed function is a simple trick to be able to create a tuple (function, args, kwargs) with a function-call syntax. I’m using it to iterate over the list …

Total answers: 4

How can we use tqdm in a parallel execution with joblib?

How can we use tqdm in a parallel execution with joblib? Question: I want to run a function in parallel, and wait until all parallel nodes are done, using joblib. Like in the example: from math import sqrt from joblib import Parallel, delayed Parallel(n_jobs=2)(delayed(sqrt)(i ** 2) for i in range(10)) But, I want that the …

Total answers: 9

Tracking progress of joblib.Parallel execution

Tracking progress of joblib.Parallel execution Question: Is there a simple way to track the overall progress of a joblib.Parallel execution? I have a long-running execution composed of thousands of jobs, which I want to track and record in a database. However, to do that, whenever Parallel finishes a task, I need it to execute a …

Total answers: 10