From 4c706fec35800a2be59f12e09f672a3402b9d4ed Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 5 Aug 2023 22:58:19 -0500 Subject: [PATCH 1/7] v0.1.20: bump project toml --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f5ce478..9dff6bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "amdgpu-stats" -version = "0.1.19" +version = "0.1.20" description = "A module/TUI for AMD GPU statistics" authors = ["Josh Lay "] repository = "https://github.com/joshlay/amdgpu_stats" @@ -22,7 +22,7 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.8" -textual = ">=0.30.0" +textual = ">=0.32.0" humanfriendly = ">=10.0" pyyaml = "^6.0" From a06778858d2fa0d8d7ad65ee764012142a3a24c4 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 5 Aug 2023 23:02:22 -0500 Subject: [PATCH 2/7] tui: efficiency; use new Log widget instead of TextLog. remove yml req --- src/amdgpu_stats/tui.py | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/amdgpu_stats/tui.py b/src/amdgpu_stats/tui.py index 7d8499e..01f695e 100644 --- a/src/amdgpu_stats/tui.py +++ b/src/amdgpu_stats/tui.py @@ -16,7 +16,6 @@ Functions: # pylint: disable=line-too-long from datetime import datetime from typing import Optional -from yaml import dump from rich.text import Text from textual import work @@ -32,7 +31,7 @@ from textual.widgets import ( Static, TabbedContent, TabPane, - TextLog, + Log, ) from .utils import ( @@ -129,10 +128,9 @@ class GPUStatsWidget(Static): def __init__(self, *args, cards=None, **kwargs): super().__init__(*args, **kwargs) self.cards = cards - self.text_log = TextLog(highlight=True, - markup=True, - name='log_gpu', - classes='logs') + self.text_log = Log(highlight=True, + name='log_gpu', + classes='logs') self.stats_table = DataTable(zebra_stripes=True, show_cursor=True, name='stats_table', @@ -142,18 +140,17 @@ class GPUStatsWidget(Static): def on_mount(self) -> None: '''Fires when stats widget 'mounted', behaves like on first showing''' - self.update_log("[bold green]App started, logging begin!\n") + self.update_log("App started, logging begin!") # construct the table columns columns = list(self.get_column_data_mapping(None).keys()) + self.update_log('Stat columns:') for column in columns: + self.update_log(f" - '{column}'", show_ts=False) if column in ['Limit', 'Default', 'Capability']: self.stats_table.add_column(label='[italic]' + column, key=column) else: self.stats_table.add_column(label=column, key=column) - # self.update_log(f' - "{column}"') - self.update_log('[bold]Stat columns:') - self.update_log(dump(data=columns, default_flow_style=False, sort_keys=True)) # do a one-off stat collection, populate table before the interval self.get_stats() # stand up the stat-collecting interval, twice per second @@ -176,9 +173,19 @@ class GPUStatsWidget(Static): with TabPane("Logs", id="tab_logs"): yield self.text_log - def update_log(self, message: str) -> None: - """Update the TextLog widget with a new message.""" - self.text_log.write(message) + def update_log(self, message: str, show_ts: bool = True) -> None: + """Update the Log widget with a new message. + + Highest Textual version-requiring widget; >=0.32.0 + Should be more performant than the old TextLog widget + + Args: + message (str): The message to be added to the logging widget on the 'Logs' tab. + show_ts (bool, optional): If True (default), appends a timestamp to the message. + """ + if show_ts: + message = f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] {message}" + self.text_log.write_line(message) @work(exclusive=True) async def get_stats(self): From 0281fa93b2ab450556d607bc572c5db77d518e88 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 5 Aug 2023 23:02:52 -0500 Subject: [PATCH 3/7] remove requirement for pyyaml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9dff6bf..b6445c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,6 @@ classifiers = [ python = "^3.8" textual = ">=0.32.0" humanfriendly = ">=10.0" -pyyaml = "^6.0" [tool.poetry.scripts] amdgpu-stats = "amdgpu_stats:textual_run" From 394a8f50f5207f47c106cd19bdf104ef897b1791 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sat, 5 Aug 2023 23:05:12 -0500 Subject: [PATCH 4/7] readme/screens: add new logs --- README.md | 1 + screens/logs.svg | 165 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 screens/logs.svg diff --git a/README.md b/README.md index ce15469..a09732e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A Python module/TUI for AMD GPU statistics ![Screenshot of the main stats table](https://raw.githubusercontent.com/joshlay/amdgpu_stats/master/screens/main.svg "Main screen") ![Screenshot of the 'graphing' scroll bars](https://raw.githubusercontent.com/joshlay/amdgpu_stats/master/screens/graphs.svg "Graphs") +![Screenshot of the 'Logs' tab pane](https://raw.githubusercontent.com/joshlay/amdgpu_stats/master/screens/logs.svg "Logs") Tested _only_ on `RX6000` series cards; APUs and more _may_ be supported. Please file an issue if finding incompatibility! diff --git a/screens/logs.svg b/screens/logs.svg new file mode 100644 index 0000000..c12384c --- /dev/null +++ b/screens/logs.svg @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AMD GPU Stats + + + + + + + + + + AMD GPU Stats — logs22:56:06 + +StatsGraphsLogs +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +[2023-08-0522:55:55] App started, logging begin!▄▄ +[2023-08-0522:55:55] Stat columns: +  - 'Card' +  - 'Core clock' +  - 'Memory clock' +  - 'Utilization' +  - 'Voltage' +  - 'Power' +  - 'Limit' +  - 'Default' +  - 'Capability' +  - 'Fan RPM' +  - 'Edge temp' +  - 'Junction temp' +  - 'Memory temp' +[2023-08-0522:55:55] Added row for 'card0', stats dir: '/sys/class/drm/card0/device/hwmon/hwmon3' +▀▀ +▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + C  Colors  T  Tab switch  S  Screenshot  ↑  Scroll Logs  ↓  Scroll Logs  Q  Quit  + + + From b2876da620427e8903707cb1831c3a61f0c5553b Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 6 Aug 2023 01:40:57 -0500 Subject: [PATCH 5/7] project: update repo URL, leave GitHub --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b6445c4..1eed51b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "amdgpu-stats" version = "0.1.20" description = "A module/TUI for AMD GPU statistics" authors = ["Josh Lay "] -repository = "https://github.com/joshlay/amdgpu_stats" +repository = "https://git.jlay.dev/jlay/amdgpu_stats" license = "MIT" readme = "README.md" documentation = "https://amdgpu-stats.readthedocs.io/en/latest/" From 65dd98040c1e1e58a3c31476aef210f66bf3fe84 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 6 Aug 2023 01:43:52 -0500 Subject: [PATCH 6/7] use forgejo workflow file --- {.github => .forgejo}/workflows/pylint.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {.github => .forgejo}/workflows/pylint.yml (74%) diff --git a/.github/workflows/pylint.yml b/.forgejo/workflows/pylint.yml similarity index 74% rename from .github/workflows/pylint.yml rename to .forgejo/workflows/pylint.yml index bda3e4a..9e596a4 100644 --- a/.github/workflows/pylint.yml +++ b/.forgejo/workflows/pylint.yml @@ -7,11 +7,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8.17", "3.9.17", "3.10.12", "3.11.4"] steps: - - uses: actions/checkout@v3 + - uses: https://github.com/actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 + uses: https://github.com/actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies From 9da963e56344c4a1d5a3e776caa99d87115d8668 Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Sun, 6 Aug 2023 01:45:31 -0500 Subject: [PATCH 7/7] workflow: try fixing titles with quotes --- .forgejo/workflows/pylint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/pylint.yml b/.forgejo/workflows/pylint.yml index 9e596a4..72d4b4d 100644 --- a/.forgejo/workflows/pylint.yml +++ b/.forgejo/workflows/pylint.yml @@ -10,7 +10,7 @@ jobs: python-version: ["3.8.17", "3.9.17", "3.10.12", "3.11.4"] steps: - uses: https://github.com/actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: "Set up Python ${{ matrix.python-version }}" uses: https://github.com/actions/setup-python@v3 with: python-version: ${{ matrix.python-version }}