def __write_once()

in datahub/client/producer/shard_writer.py [0:0]


    def __write_once(self, records):
        retry_time = 0
        while True:
            try:
                self._message_writer.put_record_by_shard(self._shard_id, records)
                self._has_write_count += len(records)
                return
            except DatahubException as e:
                self._logger.warning("Write records fail. key: {}, shard_id: {}, records size: {}, max retry time: {}, this time: {}, DatahubException: {}"
                                     .format(self._uniq_key, self._shard_id, len(records), self._max_retry_times, retry_time, e))
                retry_time += 1
                if retry_time >= self._max_retry_times:
                    raise e
            except Exception as e:
                self._logger.warning("Write records fail. key: {}, shard_id: {}, records size: {}, {}".format(self._uniq_key, self._shard_id, len(records), e))
                raise e