I agree with @phyrox, that dill
can be used to persist your live objects to disk so you can restart later. dill
can serialize numpy
arrays with dump()
, and the entire interpreter session with dump_session()
.
However, it sounds like you are really asking about some form of caching… so I'd have to say that the comment from @Alfe is probably a bit closer to what you want. If you want seamless caching and archiving of arrays to memory… then you want joblib
or klepto
.
klepto
is built on top of dill
, and can cache function inputs and outputs to memory (so that calculations don't need to be run twice), and it can seamlessly persist objects in the cache to disk or to a database.
The versions on github are the ones you want. https://github.com/uqfoundation/klepto or https://github.com/joblib/joblib. Klepto is newer, but has a much broader set of caching and archiving solutions than joblib. Joblib has been in production use longer, so it's better tested -- especially for parallel computing.
Here's an example of typical klepto workflow: https://github.com/uqfoundation/klepto/blob/master/tests/test_workflow.py
Here's another that has some numpy
in it:
https://github.com/uqfoundation/klepto/blob/master/tests/test_cache.py