Invoked when a batch submission fails, this method will submit one
    measurement to InfluxDB. It then adds a timeout to the IOLoop which will
    invoke :meth:`_write_error_batch_wait` which will evaluate the result and
    then determine what to do next.

    :param str batch: The batch ID for correlation purposes
    :param str database: The database name for the measurements
    :param list measurements: The measurements that failed to write as a batch

def _write_error_batch(batch, database, measurements):
    """Invoked when a batch submission fails, this method will submit one
    measurement to InfluxDB. It then adds a timeout to the IOLoop which will
    invoke :meth:`_write_error_batch_wait` which will evaluate the result and
    then determine what to do next.

    :param str batch: The batch ID for correlation purposes
    :param str database: The database name for the measurements
    :param list measurements: The measurements that failed to write as a batch

    """
    if not measurements:
        LOGGER.info('All %s measurements from batch %s processed',
                    database, batch)
        return

    LOGGER.debug('Processing batch %s for %s by measurement, %i left',
                 batch, database, len(measurements))

    url = '{}?db={}&precision=ms'.format(_base_url, database)

    measurement = measurements.pop(0)

    # Create the request future
    future = _http_client.fetch(
        url, method='POST', body=measurement.encode('utf-8'))

    # Check in 25ms to see if it's done
    ioloop.IOLoop.current().add_timeout(
        ioloop.IOLoop.current().time() + 0.025,
        _write_error_batch_wait, future, batch, database, measurement,
        measurements)