From 573ec7caf09305e59b22cc24ba0493a40f6bc5a5 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sun, 14 Apr 2019 19:16:53 +0900 Subject: _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. --- buildstream/_artifactcache/casserver.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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 -- cgit v1.2.1