Base class#

class tango.step_cache.StepCache[source]#

This is a mapping from instances of Step to the results of that step. Generally StepCache implementations are used internally by Workspace implementations.


This is a generic implementation of __contains__. If you are writing your own StepCache, you might want to write a faster one yourself.

Return type


abstract __getitem__(step)[source]#

Returns the results for the given step.

Return type


abstract __len__()[source]#

Returns the number of results saved in this cache.

Return type


abstract __setitem__(step, value)[source]#

Writes the results for the given step. Throws an exception if the step is already cached.

Return type


default_implementation: Optional[str] = 'memory'#

The default implementation is MemoryStepCache.


class tango.step_caches.LocalStepCache(dir)[source]#

This is a StepCache that stores its results on disk, in the location given in dir.

Every cached step gets a directory under dir with that step’s unique_id. In that directory we store the results themselves in some format according to the step’s FORMAT, and we also write a cache-metadata.json file that stores the CacheMetadata.

The presence of cache-metadata.json signifies that the cache entry is complete and has been written successfully.


Registered as StepCache under the name “local”.


Returns the directory that contains the results of the step.

You can use this even for a step that’s not cached yet. In that case it will return the directory where the results will be written.

Return type


class tango.step_caches.MemoryStepCache[source]#

This is a StepCache that stores results in memory. It is little more than a Python dictionary.


Registered as StepCache under the name “memory”.


class tango.step_cache.CacheMetadata(step, format)[source]#
format: Format#

The format used to serialize the step’s result.

step: str#

The step name.