Correct an issue when stats use old stats (example network). Had also to deal with the export CSV module not working.

pull/1872/head
nicolargo 2021-05-23 23:07:06 +02:00
parent 0417762d96
commit 90b28dc633
5 changed files with 22 additions and 5 deletions

View File

@ -107,6 +107,9 @@ class Export(GlancesExport):
# Others lines: stats
csv_data += itervalues(all_stats[plugin])
logger.info(len(csv_data))
logger.info(csv_data)
# Export to CSV
# Manage header
if self.first_line:

View File

@ -52,6 +52,7 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Hide stats if it has never been != 0
if config is not None:
self.hide_zero = config.get_bool_value(
@ -60,6 +61,10 @@ class Plugin(GlancesPlugin):
self.hide_zero = False
self.hide_zero_fields = ['read_bytes', 'write_bytes']
# Force a first update because we need two update to have the first stat
self.update()
self.refresh_timer.set(0)
def get_key(self):
"""Return the key of the list."""
return 'disk_name'

View File

@ -95,6 +95,10 @@ class Plugin(GlancesPlugin):
# value: instance of ThreadDockerGrabber
self.thread_list = {}
# Force a first update because we need two update to have the first stat
self.update()
self.refresh_timer.set(0)
def exit(self):
"""Overwrite the exit method to close threads."""
for t in itervalues(self.thread_list):

View File

@ -60,6 +60,7 @@ class Plugin(GlancesPlugin):
# We want to display the stat in the curse interface
self.display_curse = True
# Hide stats if it has never been != 0
if config is not None:
self.hide_zero = config.get_bool_value(
@ -68,11 +69,15 @@ class Plugin(GlancesPlugin):
self.hide_zero = False
self.hide_zero_fields = ['rx', 'tx']
# Force a first update because we need two update to have the first stat
self.update()
self.refresh_timer.set(0)
def get_key(self):
"""Return the key of the list."""
return 'interface_name'
@GlancesPlugin._check_decorator
# @GlancesPlugin._check_decorator
@GlancesPlugin._log_result_decorator
def update(self):
"""Update network stats using the input method.

View File

@ -1013,7 +1013,7 @@ class GlancesPlugin(object):
- if the refresh_timer is finished
"""
def wrapper(self, *args, **kw):
if self.is_enable() and self.refresh_timer.finished():
if self.is_enable() and (self.refresh_timer.finished() or self.stats == {} or self.stats == []):
# Run the method
ret = fct(self, *args, **kw)
# Reset the timer