mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-15 06:52:39 +02:00
[caching] catching key error, when individuum is already gone
This commit is contained in:
parent
9bf7e1baf6
commit
c2e3bf5bce
1 changed files with 9 additions and 7 deletions
|
|
@ -57,13 +57,15 @@ class Cacher(object):
|
||||||
for ind in combined_args_kw:
|
for ind in combined_args_kw:
|
||||||
if ind is not None:
|
if ind is not None:
|
||||||
ind_id = self.id(ind)
|
ind_id = self.id(ind)
|
||||||
ref, cache_ids = self.cached_input_ids[ind_id]
|
tmp = self.cached_input_ids.get(ind_id, None)
|
||||||
if len(cache_ids) == 1 and ref() is not None:
|
if tmp is not None:
|
||||||
ref().remove_observer(self, self.on_cache_changed)
|
ref, cache_ids = tmp
|
||||||
del self.cached_input_ids[ind_id]
|
if len(cache_ids) == 1 and ref() is not None:
|
||||||
else:
|
ref().remove_observer(self, self.on_cache_changed)
|
||||||
cache_ids.remove(cache_id)
|
del self.cached_input_ids[ind_id]
|
||||||
self.cached_input_ids[ind_id] = [ref, cache_ids]
|
else:
|
||||||
|
cache_ids.remove(cache_id)
|
||||||
|
self.cached_input_ids[ind_id] = [ref, cache_ids]
|
||||||
self.logger.debug("removing caches")
|
self.logger.debug("removing caches")
|
||||||
del self.cached_outputs[cache_id]
|
del self.cached_outputs[cache_id]
|
||||||
del self.inputs_changed[cache_id]
|
del self.inputs_changed[cache_id]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue