[Notes] [Git][BuildStream/buildstream][mablanch/668-remote-build-failure] _sandboxremote.py: Handle remote build execution exit code



Title: GitLab

Martin Blanchard pushed to branch mablanch/668-remote-build-failure at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/sandbox/_sandboxremote.py
    ... ... @@ -27,6 +27,7 @@ from . import Sandbox
    27 27
     from ..storage._filebaseddirectory import FileBasedDirectory
    
    28 28
     from ..storage._casbaseddirectory import CasBasedDirectory
    
    29 29
     from .._protos.build.bazel.remote.execution.v2 import remote_execution_pb2, remote_execution_pb2_grpc
    
    30
    +from .._protos.google.rpc import code_pb2
    
    30 31
     from .._platform import Platform
    
    31 32
     
    
    32 33
     
    
    ... ... @@ -235,15 +236,20 @@ class SandboxRemote(Sandbox):
    235 236
     
    
    236 237
             operation.response.Unpack(execution_response)
    
    237 238
     
    
    238
    -        if execution_response.status.code != 0:
    
    239
    -            # A normal error during the build: the remote execution system
    
    240
    -            # has worked correctly but the command failed.
    
    241
    -            # execution_response.error also contains 'message' (str) and
    
    242
    -            # 'details' (iterator of Any) which we ignore at the moment.
    
    243
    -            return execution_response.status.code
    
    239
    +        if execution_response.status.code != code_pb2.OK:
    
    240
    +            # An unexpected error during execution: the remote execution
    
    241
    +            # system failed at processing the execution request.
    
    242
    +            raise SandboxError(execution_response.status.message)
    
    244 243
     
    
    245 244
             action_result = execution_response.result
    
    246 245
     
    
    246
    +        if action_result.exit_code != 0:
    
    247
    +            # A normal error during the build: the remote execution system
    
    248
    +            # has worked correctly but the command failed.
    
    249
    +            # action_result.stdout and action_result.stderr also contains
    
    250
    +            # build command outputs which we ignore at the moment.
    
    251
    +            return action_result.exit_code
    
    252
    +
    
    247 253
             self.process_job_output(action_result.output_directories, action_result.output_files)
    
    248 254
     
    
    249 255
             return 0



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