summaryrefslogtreecommitdiff
path: root/src/buildstream/_cas
diff options
context:
space:
mode:
authorbschubert15 <bschubert15@bloomberg.net>2020-03-18 10:28:56 +0000
committerBenjamin Schubert <contact@benschubert.me>2020-03-24 14:26:22 +0000
commit4922c0481898ac3d043be7782617d6eebd518b1e (patch)
tree2b8fe359e76021c0780da086dca293c128406672 /src/buildstream/_cas
parentaec9deb3b7cd759ee35751b2e27fb54f7966b0b2 (diff)
downloadbuildstream-4922c0481898ac3d043be7782617d6eebd518b1e.tar.gz
cascache.py: Create cas logs in the buildstream cache directory
This moves the cas logs outside of the cas directory. Since BuildStream is responsible for creating and handling the logs, it should not be in the cas directory.
Diffstat (limited to 'src/buildstream/_cas')
-rw-r--r--src/buildstream/_cas/cascache.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/buildstream/_cas/cascache.py b/src/buildstream/_cas/cascache.py
index cfdd4af09..53cadc744 100644
--- a/src/buildstream/_cas/cascache.py
+++ b/src/buildstream/_cas/cascache.py
@@ -62,10 +62,18 @@ class CASLogLevel(FastEnum):
# cache_quota (int): User configured cache quota
# protect_session_blobs (bool): Disable expiry for blobs used in the current session
# log_level (LogLevel): Log level to give to buildbox-casd for logging
+# log_directory (str): the root of the directory in which to store logs
#
class CASCache:
def __init__(
- self, path, *, casd=True, cache_quota=None, protect_session_blobs=True, log_level=CASLogLevel.WARNING
+ self,
+ path,
+ *,
+ casd=True,
+ cache_quota=None,
+ protect_session_blobs=True,
+ log_level=CASLogLevel.WARNING,
+ log_directory=None
):
self.casdir = os.path.join(path, "cas")
self.tmpdir = os.path.join(path, "tmp")
@@ -78,7 +86,8 @@ class CASCache:
self._casd_process_manager = None
self._casd_channel = None
if casd:
- log_dir = os.path.join(self.casdir, "logs")
+ assert log_directory is not None, "log_directory is required when casd is True"
+ log_dir = os.path.join(log_directory, "_casd")
self._casd_process_manager = CASDProcessManager(
path, log_dir, log_level, cache_quota, protect_session_blobs
)