def __init__(self):
     self._lock = threading.Lock()
     # Boolean indicating if a CancelAcquisition RPC has been received for this acquisition request.
     self._cancelled = False
     # The current status of the request, including any data errors.
     self._status_proto = data_acquisition_pb2.GetStatusResponse(
         status=data_acquisition_pb2.GetStatusResponse.STATUS_ACQUIRING)
     # The time which the acquisition request completes; used by the RequestManager for cleanup.
     self._completion_time = None
    def get_status_proto(self, request_id):
        """Get a copy of the current status for the specified request.

        Args:
            request_id (int): The request_id for the acquisition request being inspected.
        """
        state = self.get_request_state(request_id)
        status = data_acquisition_pb2.GetStatusResponse()
        with state._lock:
            status.CopyFrom(state._status_proto)
        return status
    def GetStatus(self, request, context):
        """Query the status of a data acquisition by ID.

        Args:
            request (data_acquisition_pb2.GetStatusRequest): The get status request.
            context (GRPC ClientContext): tracks internal grpc statuses and information.

        Returns:
            An GetStatusResponse containing the details of the data acquisition.
        """
        try:
            response = self.request_manager.get_status_proto(
                request.request_id)
        except KeyError:
            response = data_acquisition_pb2.GetStatusResponse()
            response.status = response.STATUS_REQUEST_ID_DOES_NOT_EXIST
        populate_response_header(response, request)
        return response
    def GetStatus(self, request, context):
        """Query the status of a data acquisition by ID.

        Args:
            request (data_acquisition_pb2.GetStatusRequest): The get status request.
            context (GRPC ClientContext): tracks internal grpc statuses and information.

        Returns:
            An GetStatusResponse containing the details of the data acquisition.
        """
        response = data_acquisition_pb2.GetStatusResponse()
        with ResponseContext(response, request, self.data_buffer_client):
            try:
                # Note: this needs to be a copy from and not '=' such that the response that is logged
                # in the request context gets updated.
                response.CopyFrom(
                    self.request_manager.get_status_proto(request.request_id))
            except KeyError:
                response.status = response.STATUS_REQUEST_ID_DOES_NOT_EXIST
            populate_response_header(response, request)
        return response