From 865d18d367bd1c7b38c1233eda235157791110d7 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 4 Mar 2021 11:01:17 -0500 Subject: [PATCH] Back off progress update on file copy The output was too frenzied, cool it down to fewer updates. --- confluent_server/confluent/osimage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index 565d5c00..e63571d3 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -529,12 +529,15 @@ def import_image(filename, callback, backend=False, mfd=None): currsz = 0 modpct = 1.0 - pct archive.seek(0, 0) + printat = 0 with open(targiso, 'wb') as targ: buf = archive.read(32768) while buf: currsz += len(buf) pgress = pct + ((float(currsz) / float(totalsz)) * modpct) - callback({'progress': pgress}) + if time.time() > printat: + callback({'progress': pgress}) + printat = time.time() + 0.5 targ.write(buf) buf = archive.read(32768) with open(targpath + '/distinfo.yaml', 'w') as distinfo: