diff options
Diffstat (limited to 'src/buildstream/_cas/cascache.py')
-rw-r--r-- | src/buildstream/_cas/cascache.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py index 43375c635..a62bc3d44 100644 --- a/src/buildstream/_cas/cascache.py +++ b/src/buildstream/_cas/cascache.py @@ -37,7 +37,7 @@ from .._protos.google.rpc import code_pb2 from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc from .._protos.build.buildgrid import local_cas_pb2, local_cas_pb2_grpc -from .. import utils +from .. import _signals, utils from .._exceptions import CASCacheError from .._message import Message, MessageType @@ -91,8 +91,11 @@ class CASCache(): self.casd_logfile = self._rotate_and_get_next_logfile() with open(self.casd_logfile, "w") as logfile_fp: - self._casd_process = subprocess.Popen( - casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT) + # Block SIGINT on buildbox-casd, we don't need to stop it + # The frontend will take care of it if needed + with _signals.blocked([signal.SIGINT], ignore=False): + self._casd_process = subprocess.Popen( + casd_args, cwd=path, stdout=logfile_fp, stderr=subprocess.STDOUT) else: self._casd_process = None @@ -1085,8 +1088,11 @@ class _CASCacheUsageMonitor: # This can't be allowed with background threads or open gRPC channels. assert utils._is_single_threaded() and not cas.has_open_grpc_channels() - self._subprocess = multiprocessing.Process(target=self._subprocess_run) - self._subprocess.start() + # Block SIGINT, we don't want to kill the process when we interrupt the frontend + # and this process if very lightweight. + with _signals.blocked([signal.SIGINT], ignore=False): + self._subprocess = multiprocessing.Process(target=self._subprocess_run) + self._subprocess.start() def get_cache_usage(self): disk_usage = self._disk_usage.value |