mirror of
https://github.com/psy0rz/zfs_autobackup.git
synced 2025-05-30 01:19:16 +03:00
cleaned up progress stuff
This commit is contained in:
parent
af9d768410
commit
60560b884b
@ -637,7 +637,7 @@ class ZfsDataset:
|
|||||||
else:
|
else:
|
||||||
valid_exitcodes = [0]
|
valid_exitcodes = [0]
|
||||||
|
|
||||||
self.zfs_node.reset_progress()
|
# self.zfs_node.reset_progress()
|
||||||
self.zfs_node.run(cmd, inp=pipe, valid_exitcodes=valid_exitcodes)
|
self.zfs_node.run(cmd, inp=pipe, valid_exitcodes=valid_exitcodes)
|
||||||
|
|
||||||
# invalidate cache, but we at least know we exist now
|
# invalidate cache, but we at least know we exist now
|
||||||
|
@ -109,10 +109,10 @@ class ZfsNode(ExecuteNode):
|
|||||||
|
|
||||||
return self.__datasets.setdefault(name, ZfsDataset(self, name, force_exists))
|
return self.__datasets.setdefault(name, ZfsDataset(self, name, force_exists))
|
||||||
|
|
||||||
def reset_progress(self):
|
# def reset_progress(self):
|
||||||
"""reset progress output counters"""
|
# """reset progress output counters"""
|
||||||
self._progress_total_bytes = 0
|
# self._progress_total_bytes = 0
|
||||||
self._progress_start_time = time.time()
|
# self._progress_start_time = time.time()
|
||||||
|
|
||||||
def parse_zfs_progress(self, line, hide_errors, prefix):
|
def parse_zfs_progress(self, line, hide_errors, prefix):
|
||||||
"""try to parse progress output of zfs recv -Pv, and don't show it as error to the user """
|
"""try to parse progress output of zfs recv -Pv, and don't show it as error to the user """
|
||||||
@ -132,13 +132,13 @@ class ZfsNode(ExecuteNode):
|
|||||||
# actual useful info
|
# actual useful info
|
||||||
if len(progress_fields) >= 3:
|
if len(progress_fields) >= 3:
|
||||||
if progress_fields[0] == 'full' or progress_fields[0] == 'size':
|
if progress_fields[0] == 'full' or progress_fields[0] == 'size':
|
||||||
# Reset the total bytes and start the timer again (otherwise the MB/s
|
# Reset the total bytes and start the timer again (otherwise the MB/s
|
||||||
# counter gets confused)
|
# counter gets confused)
|
||||||
self._progress_total_bytes = int(progress_fields[2])
|
self._progress_total_bytes = int(progress_fields[2])
|
||||||
self._progress_start_time = time.time()
|
self._progress_start_time = time.time()
|
||||||
elif progress_fields[0] == 'incremental':
|
elif progress_fields[0] == 'incremental':
|
||||||
# Reset the total bytes and start the timer again (otherwise the MB/s
|
# Reset the total bytes and start the timer again (otherwise the MB/s
|
||||||
# counter gets confused)
|
# counter gets confused)
|
||||||
self._progress_total_bytes = int(progress_fields[3])
|
self._progress_total_bytes = int(progress_fields[3])
|
||||||
self._progress_start_time = time.time()
|
self._progress_start_time = time.time()
|
||||||
elif progress_fields[1].isnumeric():
|
elif progress_fields[1].isnumeric():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user