Clean unused decorator

This commit is contained in:
nicolargo 2025-09-28 15:00:37 +02:00
parent 6539979498
commit 48674ee71f
7 changed files with 4099 additions and 721 deletions

View File

@ -35,6 +35,11 @@ system:
[fs]
allow=shm
With the above configuration key, it is also possible to monitor NFS
mount points (allow=nfs). Be aware that this can slow down the
performance of the plugin if the NFS server is not reachable. In this
case, the plugin will wait for a 2 seconds timeout.
Also, you can hide mount points using regular expressions.
To hide all mount points starting with /boot and /snap:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "GLANCES" "1" "Sep 25, 2025" "4.4.0_dev4" "Glances"
.TH "GLANCES" "1" "Sep 28, 2025" "4.4.0_dev5" "Glances"
.SH NAME
glances \- An eye on your system
.SH SYNOPSIS

View File

@ -19,7 +19,7 @@ import tracemalloc
# Global name
# Version should start and end with a numerical char
# See https://packaging.python.org/specifications/core-metadata/#version
__version__ = "4.4.0_dev4"
__version__ = "4.4.0_dev5"
__apiversion__ = '4'
__author__ = 'Nicolas Hennion <nicolas@nicolargo.com>'
__license__ = 'LGPLv3'
@ -188,3 +188,4 @@ def main():
# Glances can be ran in standalone, client or server mode
start(config=core.get_config(), args=core.get_args())
start(config=core.get_config(), args=core.get_args())

View File

@ -88,7 +88,7 @@ snmp_oid['esxi'] = snmp_oid['windows']
items_history_list = [{'name': 'percent', 'description': 'File system usage in percent', 'y_unit': '%'}]
@exit_after(1, default=None)
@exit_after(3, default=None)
def get_disk_usage(fs):
"""Return all partitions."""
try:
@ -137,22 +137,13 @@ class FsPlugin(GlancesPluginModel):
return self.stats
@GlancesPluginModel._exit_after(3)
def get_all_stats_partitions(self):
"""Return all partitions."""
try:
return psutil.disk_partitions(all=True)
except (UnicodeDecodeError, PermissionError):
logger.debug("Plugin - fs: PsUtil fetch failed")
return []
@GlancesPluginModel._exit_after(3)
def get_disk_partitions(self, *, fetch_all: bool = False):
"""Return all partitions."""
try:
# Grab the stats using the psutil disk_partitions
# If fetch_all is False, then returns physical devices only (e.g. hard disks, cd-rom drives, USB keys)
# and ignore all others (e.g. memory partitions such as /dev/shm)
# Else return all mount points (including logical mount points like NFS, tmpfs, shm, ...)
return psutil.disk_partitions(all=fetch_all)
except (UnicodeDecodeError, PermissionError):
logger.debug("Plugin - fs: PsUtil fetch failed")

View File

@ -14,12 +14,6 @@ I am your father...
import copy
import re
import threading
try:
import thread
except ImportError:
import _thread as thread
from glances.actions import GlancesActions
from glances.events_list import glances_events
@ -1218,25 +1212,7 @@ class GlancesPluginModel:
return wrapper
def _exit_after(second):
"""Exit the function if it takes more than 'second' seconds to complete."""
def outer(fn):
def inner(*args, **kwargs):
timer = threading.Timer(second, thread.interrupt_main, args=[fn.__name__])
timer.start()
try:
result = fn(*args, **kwargs)
finally:
timer.cancel()
return result
return inner
return outer
# Mandatory to call the decorator in child classes
_check_decorator = staticmethod(_check_decorator)
_log_result_decorator = staticmethod(_log_result_decorator)
_manage_rate = staticmethod(_manage_rate)
_exit_after = staticmethod(_exit_after)