Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual cache handling #1531

Open
Richienb opened this issue Dec 13, 2023 · 1 comment
Open

Manual cache handling #1531

Richienb opened this issue Dec 13, 2023 · 1 comment

Comments

@Richienb
Copy link

To best utilize the GPU, my inputs should be processed in batches (speedup ~20 hours to ~2 hours). So, I want to run the function on the inputs in batches and manually update the cache with the returned values, so that later processes that take them one by one would be pulling from the cache. - am requesting a public API for this.

@Richienb
Copy link
Author

Richienb commented Dec 14, 2023

Short guide using internal methods in 1.3.2:

from joblib import Memory

mem = Memory('.cache')

f = mem.cache(expensive_operation)

ids = f._get_output_identifiers(*args, **kwargs)

# Check if in cache
f._is_in_cache_and_valid(ids)

# Store in cache
f.store_backend.dump_item(ids, f(*args, **kwargs), verbose=f._verbose)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant