From 414b09e685fd8a0ad049c19b7c7b198c64fdfce4 Mon Sep 17 00:00:00 2001 From: Andrew Theurer Date: Mon, 5 Aug 2024 16:22:07 -0400 Subject: [PATCH] make metric_data_file_prefix global in functions - otherwise finish_samples() returns empty string --- python/toolbox/metrics.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/toolbox/metrics.py b/python/toolbox/metrics.py index b0b296f..8065ee4 100644 --- a/python/toolbox/metrics.py +++ b/python/toolbox/metrics.py @@ -98,7 +98,7 @@ def log_sample(this_file_id: str, desc: object, names: object, sample: object): None """ - global file_id, total_logged_samples, total_cons_samples, stored_sample + global file_id, total_logged_samples, total_cons_samples, stored_sample, metric_data_file_prefix file_id = this_file_id metric_data_file_prefix = "metric-data-" + file_id metric_data_file = metric_data_file_prefix + ".csv.xz" @@ -167,7 +167,7 @@ def finish_samples(): str: The prefix of the metric data file that was written. """ - global file_id, stored_sample, interval, metric_idx, metric_types + global file_id, stored_sample, interval, metric_idx, metric_types, metric_data_file_prefix if file_id is not None: new_metric_types = [] num_deletes = 0