[Notes] [Git][BuildGrid/buildgrid][master] Return empty message after exception is raised



Title: GitLab

finnball pushed to branch master at BuildGrid / buildgrid

Commits:

4 changed files:

Changes:

  • buildgrid/server/execution/action_cache_service.py
    ... ... @@ -24,6 +24,7 @@ import logging
    24 24
     
    
    25 25
     import grpc
    
    26 26
     
    
    27
    +from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2
    
    27 28
     from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc
    
    28 29
     
    
    29 30
     from .._exceptions import NotFoundError
    
    ... ... @@ -39,13 +40,19 @@ class ActionCacheService(remote_execution_pb2_grpc.ActionCacheServicer):
    39 40
             try:
    
    40 41
                 return self._action_cache.get_action_result(request.action_digest)
    
    41 42
     
    
    42
    -        except NotFoundError:
    
    43
    +        except NotFoundError as e:
    
    44
    +            self.logger.error(e)
    
    43 45
                 context.set_code(grpc.StatusCode.NOT_FOUND)
    
    44 46
     
    
    47
    +        return remote_execution_pb2.ActionResult()
    
    48
    +
    
    45 49
         def UpdateActionResult(self, request, context):
    
    46 50
             try:
    
    47 51
                 self._action_cache.update_action_result(request.action_digest, request.action_result)
    
    48 52
                 return request.action_result
    
    49 53
     
    
    50
    -        except NotImplementedError:
    
    54
    +        except NotImplementedError as e:
    
    55
    +            self.logger.error(e)
    
    51 56
                 context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    
    57
    +
    
    58
    +        return remote_execution_pb2.ActionResult()

  • buildgrid/server/execution/execution_service.py
    ... ... @@ -28,6 +28,8 @@ import grpc
    28 28
     
    
    29 29
     from buildgrid._protos.build.bazel.remote.execution.v2 import remote_execution_pb2_grpc
    
    30 30
     
    
    31
    +from buildgrid._protos.google.longrunning import operations_pb2
    
    32
    +
    
    31 33
     from .._exceptions import InvalidArgumentError
    
    32 34
     
    
    33 35
     
    
    ... ... @@ -55,11 +57,13 @@ class ExecutionService(remote_execution_pb2_grpc.ExecutionServicer):
    55 57
                 self.logger.error(e)
    
    56 58
                 context.set_details(str(e))
    
    57 59
                 context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
    
    60
    +            yield operations_pb2.Operation()
    
    58 61
     
    
    59 62
             except NotImplementedError as e:
    
    60 63
                 self.logger.error(e)
    
    61 64
                 context.set_details(str(e))
    
    62 65
                 context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    
    66
    +            yield operations_pb2.Operation()
    
    63 67
     
    
    64 68
         def WaitExecution(self, request, context):
    
    65 69
             try:
    
    ... ... @@ -77,6 +81,7 @@ class ExecutionService(remote_execution_pb2_grpc.ExecutionServicer):
    77 81
                 self.logger.error(e)
    
    78 82
                 context.set_details(str(e))
    
    79 83
                 context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
    
    84
    +            yield operations_pb2.Operation()
    
    80 85
     
    
    81 86
         def _remove_client(self, operation_name, message_queue):
    
    82 87
             self._instance.unregister_message_client(operation_name, message_queue)
    

  • buildgrid/server/execution/operations_service.py
    ... ... @@ -37,6 +37,7 @@ class OperationsService(operations_pb2_grpc.OperationsServicer):
    37 37
         def GetOperation(self, request, context):
    
    38 38
             try:
    
    39 39
                 return self._instance.get_operation(request.name)
    
    40
    +
    
    40 41
             except InvalidArgumentError as e:
    
    41 42
                 self.logger.error(e)
    
    42 43
                 context.set_details(str(e))
    
    ... ... @@ -52,15 +53,19 @@ class OperationsService(operations_pb2_grpc.OperationsServicer):
    52 53
         def DeleteOperation(self, request, context):
    
    53 54
             try:
    
    54 55
                 return self._instance.delete_operation(request.name)
    
    56
    +
    
    55 57
             except InvalidArgumentError as e:
    
    56 58
                 self.logger.error(e)
    
    57 59
                 context.set_details(str(e))
    
    58 60
                 context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
    
    61
    +            return operations_pb2.Operation()
    
    59 62
     
    
    60 63
         def CancelOperation(self, request, context):
    
    61 64
             try:
    
    62 65
                 return self._instance.cancel_operation(request.name)
    
    66
    +
    
    63 67
             except NotImplementedError as e:
    
    64 68
                 self.logger.error(e)
    
    65 69
                 context.set_details(str(e))
    
    66 70
                 context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    
    71
    +            return operations_pb2.Operation()

  • buildgrid/server/worker/bots_service.py
    ... ... @@ -23,6 +23,9 @@ import logging
    23 23
     
    
    24 24
     import grpc
    
    25 25
     
    
    26
    +from google.protobuf.empty_pb2 import Empty
    
    27
    +
    
    28
    +from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2
    
    26 29
     from buildgrid._protos.google.devtools.remoteworkers.v1test2 import bots_pb2_grpc
    
    27 30
     
    
    28 31
     from .._exceptions import InvalidArgumentError, OutofSyncError
    
    ... ... @@ -43,6 +46,8 @@ class BotsService(bots_pb2_grpc.BotsServicer):
    43 46
                 context.set_details(str(e))
    
    44 47
                 context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
    
    45 48
     
    
    49
    +        return bots_pb2.BotSession()
    
    50
    +
    
    46 51
         def UpdateBotSession(self, request, context):
    
    47 52
             try:
    
    48 53
                 return self._instance.update_bot_session(request.name,
    
    ... ... @@ -62,5 +67,8 @@ class BotsService(bots_pb2_grpc.BotsServicer):
    62 67
                 context.set_details(str(e))
    
    63 68
                 context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    
    64 69
     
    
    70
    +        return bots_pb2.BotSession()
    
    71
    +
    
    65 72
         def PostBotEventTemp(self, request, context):
    
    66 73
             context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    
    74
    +        return Empty()



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]