EvaluatorLease#
- class pymc_marketing.mmm.evaluator_cache.EvaluatorLease(cache, key, evaluator, *, cached)[source]#
One request’s hold on a compiled evaluator, taken out of the cache.
A leased evaluator belongs to the request until
release(): nothing else can rebind the shared draws under it, so a concurrent request misses the cache and compiles or leases a copy of its own. The evaluator is returned to the cache when the request is done, also when it raises.- Parameters:
cache (
EvaluatorCache) – The cache it was taken from and is returned to.key (
EvaluatorCacheKey) – The identity it is cached under.evaluator (
CounterfactualEvaluator) – The compiled evaluator.cached (
bool) – Whether it was taken from the cache rather than built for this request.
Methods
EvaluatorLease.__init__(cache, key, ...)Return the evaluator to the cache, once.
Attributes
The compiled evaluator this lease holds.