def Tick(self, request, context):
     response = remote_pb2.TickResponse()
     self.logger.debug('Ticked with session ID "%s"', request.session_id)
     with server_util.ResponseContext(response, request):
         with self.lock:
             self._tick_implementation(request, response)
         return response
Exemplo n.º 2
0
 def Tick(self, request, context):
     response = remote_pb2.TickResponse()
     self.logger.debug(
         'Ticked with session ID "%s" %i leases and %i inputs',
         request.session_id, len(request.leases), len(request.inputs))
     with ResponseContext(response, request):
         with self.lock:
             self._tick_implementation(request, response)
     return response
    def Tick(self, request, context):
        """Logs text, then provides a valid response."""
        response = remote_pb2.TickResponse()
        # This utility context manager will fill out some fields in the message headers.
        with ResponseContext(response, request):
            # Default to saying hello to "world".
            name = 'World'

            # See if a different name was provided to us in the request's inputs.
            # This "user-string" input is provided by the Autowalk missions.
            # To provide other inputs, see the RemoteGrpc message.
            for keyvalue in request.inputs:
                if keyvalue.key == 'user-string':
                    name = util.get_value_from_constant_value_message(
                        keyvalue.value.constant)
            self.logger.info('Hello %s!', name)
            response.status = remote_pb2.TickResponse.STATUS_SUCCESS
        return response