gnome.utilities.cache¶
cache system for caching element data on disk for accessing again for output, etc.
Attributes¶
Exceptions¶
Here so we can be sure the user knows the error is coming from here |
Classes¶
Cache for element data -- i.e. the data associated with the particles. |
Functions¶
|
Deletes a cache dir. |
Module Contents¶
- gnome.utilities.cache.global_cache_dir¶
- exception gnome.utilities.cache.CacheError¶
Bases:
Exception
Here so we can be sure the user knows the error is coming from here
Initialize self. See help(type(self)) for accurate signature.
- gnome.utilities.cache.clean_up_cache(dir_name=global_cache_dir)¶
Deletes a cache dir.
Designed to be called at program exit. and/or when individual cache objects are deleted
raises a warning if there is problem deleting a particular directory
- class gnome.utilities.cache.ElementCache(cache_dir=None, enabled=True)¶
Cache for element data – i.e. the data associated with the particles. This caches UncertainSpillContainerPair The cache can be accessed to re-draw the LE movies, etc.
- TODO: This is a really fragile module in terms of handling multiple
instances. The __del__() method of previous instances can clear the _cache_dir at the whim of the GC. We may want to manage this differently.
initialize a new cache object
- Parameters:
cache_dir=None – full path to the directory where the cache should be stored. If not provided, a temp dir will be created by the python tempfile module
- recent¶
- enabled = True¶
- lock¶
- save_timestep(step_num, spill_container_pair)¶
add a time step of data to the cache
- Parameters:
step_num – the step number of the data
spill_container – the spill container at this step
- load_timestep(step_num)¶
Returns a SpillContainer with the data arrays cached on disk
- Parameters:
step_num – the step number you want to load.
- rewind()¶
Rewinds the cache – clearing out everything