def GetDataBlockCheckpoint(self, request, context): response = tm_pb.GetDataBlockCheckpointResponse() try: response = self._get_checkpoint_fn(request) except Exception: # pylint: disable=broad-except response.status.code = common_pb.STATUS_UNKNOWN_ERROR response.status.error_message = sys.exc_info() return response
def _get_checkpoint_fn(self, request): assert request.application_id == self._application_id, \ "Application id not matched" response = tm_pb.GetDataBlockCheckpointResponse() ckpt_not_ready_fn = lambda status: status not in \ (tm_pb.MasterStatus.RUNNING, tm_pb.MasterStatus.FINISHED) if self._check_status(ckpt_not_ready_fn): response.status.code = common_pb.STATUS_WAIT_FOR_SYNCING_CHECKPOINT response.status.error_message = \ "master is not ready for querying daya checkpoint" return response response.status.code = common_pb.STATUS_SUCCESS response.status.error_message = 'success' response.block_ids.extend(list(self._allocated_data_blockids)) return response
def _get_checkpoint_fn(self, request): response = tm_pb.GetDataBlockCheckpointResponse() response.status.code = common_pb.STATUS_SUCCESS response.status.error_message = 'success' logging.info("Follower _get_checkpoint_fn, do nothing") return response