finn pushed to branch finn/improve-cas-logging at BuildGrid / buildgrid
Commits:
-
65f4b337
by Martin Blanchard at 2018-10-03T14:08:14Z
-
a88e0715
by Finn at 2018-10-03T14:35:20Z
-
4fa35bc9
by Finn at 2018-10-03T14:35:20Z
4 changed files:
- buildgrid/client/cas.py
- buildgrid/server/actioncache/service.py
- buildgrid/server/cas/service.py
- buildgrid/server/referencestorage/service.py
Changes:
... | ... | @@ -241,7 +241,7 @@ class Downloader: |
241 | 241 |
"""Fetches a blob using ByteStream.Read()"""
|
242 | 242 |
read_blob = bytearray()
|
243 | 243 |
|
244 |
- if self.instance_name is not None:
|
|
244 |
+ if self.instance_name:
|
|
245 | 245 |
resource_name = '/'.join([self.instance_name, 'blobs',
|
246 | 246 |
digest.hash, str(digest.size_bytes)])
|
247 | 247 |
else:
|
... | ... | @@ -313,7 +313,7 @@ class Downloader: |
313 | 313 |
|
314 | 314 |
def _fetch_file(self, digest, file_path):
|
315 | 315 |
"""Fetches a file using ByteStream.Read()"""
|
316 |
- if self.instance_name is not None:
|
|
316 |
+ if self.instance_name:
|
|
317 | 317 |
resource_name = '/'.join([self.instance_name, 'blobs',
|
318 | 318 |
digest.hash, str(digest.size_bytes)])
|
319 | 319 |
else:
|
... | ... | @@ -699,7 +699,7 @@ class Uploader: |
699 | 699 |
else:
|
700 | 700 |
blob_digest.hash = HASH(blob).hexdigest()
|
701 | 701 |
blob_digest.size_bytes = len(blob)
|
702 |
- if self.instance_name is not None:
|
|
702 |
+ if self.instance_name:
|
|
703 | 703 |
resource_name = '/'.join([self.instance_name, 'uploads', self.u_uid, 'blobs',
|
704 | 704 |
blob_digest.hash, str(blob_digest.size_bytes)])
|
705 | 705 |
else:
|
... | ... | @@ -52,7 +52,7 @@ class ActionCacheService(remote_execution_pb2_grpc.ActionCacheServicer): |
52 | 52 |
context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
|
53 | 53 |
|
54 | 54 |
except NotFoundError as e:
|
55 |
- self.logger.info(e)
|
|
55 |
+ self.logger.debug(e)
|
|
56 | 56 |
context.set_code(grpc.StatusCode.NOT_FOUND)
|
57 | 57 |
|
58 | 58 |
return remote_execution_pb2.ActionResult()
|
... | ... | @@ -46,8 +46,11 @@ class ContentAddressableStorageService(remote_execution_pb2_grpc.ContentAddressa |
46 | 46 |
|
47 | 47 |
def FindMissingBlobs(self, request, context):
|
48 | 48 |
try:
|
49 |
+ self.logger.debug("FindMissingBlobs request: [{}]".format(request))
|
|
49 | 50 |
instance = self._get_instance(request.instance_name)
|
50 |
- return instance.find_missing_blobs(request.blob_digests)
|
|
51 |
+ response = instance.find_missing_blobs(request.blob_digests)
|
|
52 |
+ self.logger.debug("FindMissingBlobs response: [{}]".format(response))
|
|
53 |
+ return response
|
|
51 | 54 |
|
52 | 55 |
except InvalidArgumentError as e:
|
53 | 56 |
self.logger.error(e)
|
... | ... | @@ -58,8 +61,11 @@ class ContentAddressableStorageService(remote_execution_pb2_grpc.ContentAddressa |
58 | 61 |
|
59 | 62 |
def BatchUpdateBlobs(self, request, context):
|
60 | 63 |
try:
|
64 |
+ self.logger.debug("BatchUpdateBlobs request: [{}]".format(request))
|
|
61 | 65 |
instance = self._get_instance(request.instance_name)
|
62 |
- return instance.batch_update_blobs(request.requests)
|
|
66 |
+ response = instance.batch_update_blobs(request.requests)
|
|
67 |
+ self.logger.debug("FindMissingBlobs response: [{}]".format(response))
|
|
68 |
+ return response
|
|
63 | 69 |
|
64 | 70 |
except InvalidArgumentError as e:
|
65 | 71 |
self.logger.error(e)
|
... | ... | @@ -102,6 +108,7 @@ class ByteStreamService(bytestream_pb2_grpc.ByteStreamServicer): |
102 | 108 |
|
103 | 109 |
def Read(self, request, context):
|
104 | 110 |
try:
|
111 |
+ self.logger.debug("Read request: [{}]".format(request))
|
|
105 | 112 |
path = request.resource_name.split("/")
|
106 | 113 |
instance_name = path[0]
|
107 | 114 |
|
... | ... | @@ -141,10 +148,13 @@ class ByteStreamService(bytestream_pb2_grpc.ByteStreamServicer): |
141 | 148 |
context.set_code(grpc.StatusCode.OUT_OF_RANGE)
|
142 | 149 |
yield bytestream_pb2.ReadResponse()
|
143 | 150 |
|
151 |
+ self.logger.debug("Read finished.")
|
|
152 |
+ |
|
144 | 153 |
def Write(self, requests, context):
|
145 | 154 |
try:
|
146 | 155 |
requests, request_probe = tee(requests, 2)
|
147 | 156 |
first_request = next(request_probe)
|
157 |
+ self.logger.debug("First write request: [{}]".format(first_request))
|
|
148 | 158 |
|
149 | 159 |
path = first_request.resource_name.split("/")
|
150 | 160 |
|
... | ... | @@ -164,7 +174,9 @@ class ByteStreamService(bytestream_pb2_grpc.ByteStreamServicer): |
164 | 174 |
raise InvalidArgumentError("Invalid resource name: [{}]".format(first_request.resource_name))
|
165 | 175 |
|
166 | 176 |
instance = self._get_instance(instance_name)
|
167 |
- return instance.write(requests)
|
|
177 |
+ response = instance.write(requests)
|
|
178 |
+ self.logger.debug("Write response: [{}]".format(response))
|
|
179 |
+ return response
|
|
168 | 180 |
|
169 | 181 |
except NotImplementedError as e:
|
170 | 182 |
self.logger.error(e)
|
... | ... | @@ -47,7 +47,8 @@ class ReferenceStorageService(buildstream_pb2_grpc.ReferenceStorageServicer): |
47 | 47 |
context.set_details(str(e))
|
48 | 48 |
context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
|
49 | 49 |
|
50 |
- except NotFoundError:
|
|
50 |
+ except NotFoundError as e:
|
|
51 |
+ self.logger.debug(e)
|
|
51 | 52 |
context.set_code(grpc.StatusCode.NOT_FOUND)
|
52 | 53 |
|
53 | 54 |
return buildstream_pb2.GetReferenceResponse()
|