diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2019-10-17 17:00:25 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-10-22 14:15:01 +0000 |
commit | 5de5a1c1fc0cf0f656c952cc6d7191b419dd2dad (patch) | |
tree | 6278d4ac4411d72d987c1de2f84b95b0b87390b6 /src | |
parent | d1077b64835df008c645d77d7cf635a7251e3a27 (diff) | |
download | buildstream-5de5a1c1fc0cf0f656c952cc6d7191b419dd2dad.tar.gz |
cascache: don't pickle _cache_usage_monitor
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.
Diffstat (limited to 'src')
-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 50a83875a..eb28e2df2 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -83,6 +83,7 @@ class CASCache(): self._casd_cas = None self._local_cas = None self._cache_usage_monitor = None + self._cache_usage_monitor_forbidden = False if casd: # Place socket in global/user temporary directory to avoid hitting @@ -125,6 +126,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): @@ -1047,6 +1056,7 @@ class CASCache(): # (CASCacheUsage): The current status # def get_cache_usage(self): + assert not self._cache_usage_monitor_forbidden return self._cache_usage_monitor.get_cache_usage() # get_casd_process() |