From 326044f481a1c709b605654b8dd9b98337af1d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Berkay=20=C3=9Cr=C3=BCn?= Date: Mon, 4 Sep 2023 15:29:07 +0000 Subject: [PATCH] Fix progress bar flickering --- controller.py | 6 ------ hdf5logger.py | 3 +++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/controller.py b/controller.py index 0fdb407..c37cd50 100755 --- a/controller.py +++ b/controller.py @@ -702,9 +702,6 @@ def controller( # Handlers are used for a graceful exit, in case of a signal register_signal_handlers(clogger, queue_output, p_logger) - pbar = tqdm( - total=len(faultlist), desc="Simulating faults", disable=not len(faultlist) - ) itter = 0 while 1: if stop_signal_received.value == 1: @@ -790,8 +787,6 @@ def controller( # Find finished processes p["process"].join(timeout=0) if p["process"].is_alive() is False: - # Update the progress bar - pbar.update(1) # Recalculate moving average p_time_list.append(current_time - p["start_time"]) len_p_time_list = len(p_time_list) @@ -804,7 +799,6 @@ def controller( break clogger.debug("{} experiments remaining in queue".format(queue_output.qsize())) - pbar.close() p_logger.join() clogger.debug("Done with qemu and logger") diff --git a/hdf5logger.py b/hdf5logger.py index 416300e..eef7c0c 100644 --- a/hdf5logger.py +++ b/hdf5logger.py @@ -503,6 +503,7 @@ def hdf5collector( ): n._f_remove(recursive=True) + pbar = tqdm(total=num_exp, desc="Simulating faults", disable=not num_exp) while num_exp > 0 or log_goldenrun or log_pregoldenrun or log_config: if stop_signal.value == 1: break @@ -528,6 +529,7 @@ def hdf5collector( ) ) num_exp = num_exp - 1 + pbar.update(1) elif exp["index"] == -2 and log_pregoldenrun: if "Pregoldenrun" in f.root: raise ValueError("Pregoldenrun already exists!") @@ -581,5 +583,6 @@ def hdf5collector( del exp + pbar.close() f.close() logger.debug("Data Logging done")