diff --git a/healthdata_influx/import.py b/healthdata_influx/import.py index fcb7bc8..4a87b3d 100644 --- a/healthdata_influx/import.py +++ b/healthdata_influx/import.py @@ -36,8 +36,8 @@ def parse_and_upload(self, export_path): Uploads to InfluxDB """ - def create_flusher(buffer, size, records): - def flusher(): + def create_flusher(buffer, size): + def flusher(records): print("Flushing {} points to DB. Current total: {}".format(size, records)) self.upload(buffer[:size]) # clean up @@ -51,7 +51,7 @@ def flusher(): point_buffer = [] total_records, success_records = (0, 0) - flusher = create_flusher(point_buffer, self.buffer_size, total_records) + flusher = create_flusher(point_buffer, self.buffer_size) for idx, (_, record) in enumerate(context): total_records += 1 @@ -64,7 +64,7 @@ def flusher(): output_mung_error(error, record, idx+1) if len(point_buffer) > self.buffer_size - 1: - flusher() + flusher(total_records) # memory cleanup record.clear()