diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-10-17 17:00:25 +0100 |
---|---|---|
committer | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-10-22 10:33:13 +0100 |
commit | 8810399d31e1705f9ed76aa29632aab871a08743 (patch) | |
tree | ca94b97c4c2f6118133fa015818937d5a179880e | |
parent | 27d3c61a3d91e4f0a962add150beafc3cd0fefe2 (diff) | |
download | buildstream-aevri/enable_spawn_ci_4.tar.gz |
cascache: don't pickle _cache_usage_monitoraevri/enable_spawn_ci_4
We don't need this in subprocesses, and it doesn't pickle, so don't try
to. Make sure we get an error if we do try to use it in subprocesses.
-rw-r--r-- | src/buildstream/_cas/cascache.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 83b8e8539..448a4507f 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -113,6 +113,7 @@ class CASCache(): self._casd_channel = None self._casd_cas = None self._local_cas = None + self._cache_usage_monitor_forbidden = False self._cache_usage_monitor = None def __getstate__(self): @@ -123,6 +124,14 @@ class CASCache(): assert '_casd_process' in state state['_casd_process'] = bool(self._casd_process) + # The usage monitor is not pickle-able, but we also don't need it in + # child processes currently. Make sure that if this changes, we get a + # bug report, by setting _cache_usage_monitor_forbidden. + assert '_cache_usage_monitor' in state + assert '_cache_usage_monitor_forbidden' in state + state['_cache_usage_monitor'] = None + state['_cache_usage_monitor_forbidden'] = True + return state def _init_casd(self): @@ -1046,6 +1055,7 @@ class CASCache(): # def get_cache_usage(self): if not self._cache_usage_monitor: + assert not self._cache_usage_monitor_forbidden self._cache_usage_monitor = _CASCacheUsageMonitor(self) return self._cache_usage_monitor.get_cache_usage() |