[Notes] [Git][BuildGrid/buildgrid][finn/execute-response] Added ExecuteResponse message. Fixes #38.



Title: GitLab

finnball pushed to branch finn/execute-response at BuildGrid / buildgrid

Commits:

2 changed files:

Changes:

  • app/commands/cmd_execute.py
    ... ... @@ -116,12 +116,15 @@ def list_operations(context):
    116 116
             _log_operation(context, op)
    
    117 117
     
    
    118 118
     def _log_operation(context, operation):
    
    119
    -    op_any = any_pb2.Any()
    
    120
    -    op_meta = ExecuteOperationMetadata()
    
    121
    -    op_any.CopyFrom(operation.metadata)
    
    122
    -    op_any.Unpack(op_meta)
    
    119
    +    op_meta = _unpack_any(operation.metadata, ExecuteOperationMetadata())
    
    123 120
     
    
    124 121
         context.logger.info("Name  : {}".format(operation.name))
    
    125 122
         context.logger.info("Done  : {}".format(operation.done))
    
    126
    -    context.logger.info("Stage : {}\n".format(ExecuteOperationMetadata.Stage.Name(op_meta.stage)))
    
    127
    -    context.logger.info("Key   : {}\n".format(operation.response))
    123
    +    context.logger.info("Stage : {}".format(ExecuteOperationMetadata.Stage.Name(op_meta.stage)))
    
    124
    +    context.logger.info("Key   : {}".format(operation.response))
    
    125
    +
    
    126
    +def _unpack_any(unpack_from, to):
    
    127
    +    any = any_pb2.Any()
    
    128
    +    any.CopyFrom(unpack_from)
    
    129
    +    any.Unpack(to)
    
    130
    +    return to

  • buildgrid/server/job.py
    ... ... @@ -66,9 +66,10 @@ class Job():
    66 66
         def get_operation(self):
    
    67 67
             self._operation.metadata.CopyFrom(self._pack_any(self.get_operation_meta()))
    
    68 68
     
    
    69
    -        if self.execute_stage == ExecuteStage.COMPLETED:
    
    69
    +        if self.result is not None:
    
    70 70
                 self._operation.done = True
    
    71
    -            self._operation.response.CopyFrom(self._pack_any(self.result))
    
    71
    +            response = ExecuteResponse(result = self.result)
    
    72
    +            self._operation.response.CopyFrom(self._pack_any(response))
    
    72 73
     
    
    73 74
             return self._operation
    
    74 75
     
    



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