diff --git a/app/src/DashboardPage.js b/app/src/DashboardPage.js index c5290ae6..d8b9a7eb 100644 --- a/app/src/DashboardPage.js +++ b/app/src/DashboardPage.js @@ -96,7 +96,7 @@ function FlagsMessages() { } -function EvaluateForm({defaultEvaluatedValue = 'Enter an equation above.'}) { +function EvaluateForm() { const helpContents =

Enter an equation above.

diff --git a/app/src/components/Nav.js b/app/src/components/Nav.js index 0ce30aab..1c75502e 100644 --- a/app/src/components/Nav.js +++ b/app/src/components/Nav.js @@ -121,7 +121,7 @@ export function NavBar() { const icon = ; - memoryIcon = + memoryIcon = } // Any disk is busy and processes are waiting. @@ -130,10 +130,10 @@ export function NavBar() { if (percentIOWait >= 50) { // Processes are waiting on disk, display a warning icon. const color = percentIOWait > 75 ? highWarningColor : lowWarningColor; - const icon = - + const icon = + ; - diskWaitIcon = + diskWaitIcon = } // CPU temperature. @@ -145,7 +145,7 @@ export function NavBar() { const name = temperature >= criticalTemperature ? 'thermometer' : 'thermometer half'; const icon = const link = {icon}; - temperatureIcon = ; + temperatureIcon = ; } // Power issues, this is always displayed if detected. diff --git a/wrolpi/common.py b/wrolpi/common.py index ae843988..01f1a827 100644 --- a/wrolpi/common.py +++ b/wrolpi/common.py @@ -227,7 +227,6 @@ __all__ = [ 'Base', 'ConfigFile', 'DownloadFileInfo', - 'DownloadFileInfoLink', 'LOGGING_CONFIG', 'ModelHelper', 'TRACE_LEVEL', diff --git a/wrolpi/status.py b/wrolpi/status.py index 7ba0b243..61f145be 100755 --- a/wrolpi/status.py +++ b/wrolpi/status.py @@ -15,7 +15,7 @@ import jc from wrolpi.api_utils import api_app, perpetual_signal from wrolpi.cmd import which -from wrolpi.common import logger, get_warn_once, unique_by_predicate +from wrolpi.common import logger, get_warn_once, unique_by_predicate, partition, TRACE_LEVEL from wrolpi.dates import now try: @@ -85,11 +85,9 @@ class IostatInfo: async def get_iostat_stats() -> IostatInfo: - logger.trace(f'get_iostat_stats called') - try: proc = await asyncio.create_subprocess_shell( - 'iostat', + 'iostat 3 2', # 3 second interval to gather more data, get 2 count. stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) @@ -97,10 +95,14 @@ async def get_iostat_stats() -> IostatInfo: if stdout and proc.returncode == 0: iostat_stats = jc.parse('iostat', stdout.decode(), quiet=True) if iostat_stats: - cpu_stats, *_ = iostat_stats + cpu_statuses, _ = partition(lambda i: i['type'] == 'cpu', iostat_stats) + _, cpu_stats = cpu_statuses # Use the second status because the first is a lie. - logger.trace( - f'get_iostat_stats got percent_iowait={cpu_stats["percent_iowait"]} percent_idle={cpu_stats["percent_idle"]}') + if logger.isEnabledFor(TRACE_LEVEL): + logger.trace( + f'get_iostat_stats' + f' percent_iowait={cpu_stats["percent_iowait"]}' + f' percent_idle={cpu_stats["percent_idle"]}') # Return only the CPU stats. return IostatInfo( percent_idle=cpu_stats['percent_idle'], @@ -111,6 +113,8 @@ async def get_iostat_stats() -> IostatInfo: percent_user=cpu_stats['percent_user'], ) except Exception as e: + if logger.isEnabledFor(TRACE_LEVEL): + logger.trace(f'get_iostat_stats failed: {e}') warn_iostat_once(e) return IostatInfo() @@ -164,6 +168,7 @@ TOP_REGEX = re.compile(r'^%Cpu\(s\):\s+(\d+\.\d+)', re.MULTILINE) CORE_COUNT = multiprocessing.cpu_count() + async def get_cpu_stats() -> CPUInfo: """Get core count, max freq, min freq, current freq, cpu temperature.""" percent = int(psutil.cpu_percent())