summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-14 19:16:53 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-14 19:16:53 +0900
commit573ec7caf09305e59b22cc24ba0493a40f6bc5a5 (patch)
tree12ca548f42d58d02cc98c9cfd70091dcf32ebb32
parenteff3bfff1499790575a0bdcab4288ab0fe03d1ac (diff)
downloadbuildstream-573ec7caf09305e59b22cc24ba0493a40f6bc5a5.tar.gz
_artifactcache/casserver.py: Add message handler
This needs to be added along with the status messages added to the artifact cache, and this detail diverges from master. This is because we have not bothered to backport !1071 which refactors the CASCache to be a delegate object of the ArtifactCache istead of a derived class - backporting !1071 would allow us to remove these message handlers because the CAS server and test fixture only use the CASCache object directly, not the business logic in the ArtifactCache.
-rw-r--r--buildstream/_artifactcache/casserver.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/casserver.py b/buildstream/_artifactcache/casserver.py
index 3fc0943f5..4a9d5191a 100644
--- a/buildstream/_artifactcache/casserver.py
+++ b/buildstream/_artifactcache/casserver.py
@@ -48,6 +48,13 @@ class ArtifactTooLargeException(Exception):
pass
+# We need a message handler because this will own an ArtifactCache
+# which can in turn fire messages.
+def message_handler(message, context):
+ logging.info(message.message)
+ logging.info(message.detail)
+
+
# create_server():
#
# Create gRPC CAS artifact server as specified in the Remote Execution API.
@@ -61,6 +68,7 @@ def create_server(repo, *, enable_push,
min_head_size=int(2e9)):
context = Context()
context.artifactdir = os.path.abspath(repo)
+ context.set_message_handler(message_handler)
artifactcache = context.artifactcache