ms-components 0.5.7__tar.gz → 0.5.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ms_components-0.5.7 → ms_components-0.5.8}/PKG-INFO +3 -1
- ms_components-0.5.8/licenses/lucide-LICENSE.txt +18 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/pyproject.toml +2 -2
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/detail.py +8 -4
- ms_components-0.5.8/src/ms_components/ms_monitor/icons/cpu.svg +1 -0
- ms_components-0.5.8/src/ms_components/ms_monitor/icons/gpu.svg +1 -0
- ms_components-0.5.8/src/ms_components/ms_monitor/icons/memory.svg +1 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/jobs.py +3 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/models.py +1 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/polling.py +1 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/resources.py +206 -31
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/widget.py +17 -1
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/PKG-INFO +3 -1
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/SOURCES.txt +4 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/scm_file_list.json +4 -0
- ms_components-0.5.8/src/ms_components.egg-info/scm_version.json +8 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_molsuite_monitor_widgets.py +43 -6
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_ms_projects_widget.py +10 -1
- ms_components-0.5.7/src/ms_components.egg-info/scm_version.json +0 -8
- {ms_components-0.5.7 → ms_components-0.5.8}/.github/workflows/docs.yml +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/.github/workflows/publish.yml +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/.gitignore +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/LICENSE +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/MANIFEST.in +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/README.md +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/examples/tutorial_demo.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/examples/tutorial_demo.toml +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/licenses/qt-themes-LICENSE.txt +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/setup.cfg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/backdrop.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/base.qss +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/chips.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ketcher.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/labels.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/listview.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_dockwidget/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_dockwidget/resources/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_dockwidget/resources/icons/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_dockwidget/resources/icons/folder.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_dockwidget/widget.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_executors.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/bridge.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/config.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/formatting.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/palette.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_monitor/widget.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/app.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/backend.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/browser.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_projects/scratch.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/command_line.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/actions.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/box.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/center.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/display.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/export.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/hide.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/hydrogens-polar.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/hydrogens.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/menu.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/orient.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/presets.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/rock.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/save.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/selection.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/settings.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/style.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/icons/zoom.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/plugins.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/scene.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_pymol/widget.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_settings/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_settings/panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_stepper.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/action_header.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/cell_delegate.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/column_panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/example_usage.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/filter_panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/columns.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/export.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/filter.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/menu.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/reload.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/search.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/settings.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/sort-asc.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/sort-desc.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/icons/sort.svg +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/metric_filter_bar.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/pagination_control.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/query_builder.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/session_provider.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/smart_table_view.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/sort_panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/table_config.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/table_interaction.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/table_model.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/test_external_filters.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_table/test_toolbar.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_tutorial/__init__.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_tutorial/bindings.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_tutorial/controller.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_tutorial/models.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/ms_tutorial/overlay.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/opengl.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/pagination.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/palettes.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/step_dialog.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/theme.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/tool_panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components/wheel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/dependency_links.txt +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/requires.txt +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/src/ms_components.egg-info/top_level.txt +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/conftest.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_app_settings.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_chips.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_dock_window.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_executors_ui.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_ketcher.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_molsuite_monitor_bridge.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_monitor_config.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_opengl.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_optional_integrations.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_progress_column.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_project_browser.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_pymol_command_line.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_pymol_grid.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_pymol_scene.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_pymol_toolbar.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_query_builder_keyset.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_shift_hscroll.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_split_button_style.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_step_dialog.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_table_autofill_lifecycle.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_table_interaction.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_table_toolbar.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_table_view_state.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_theme_contrast.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_theme_menu.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_tool_panel.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/tests/test_tutorial.py +0 -0
- {ms_components-0.5.7 → ms_components-0.5.8}/zensical.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ms_components
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
4
4
|
Summary: PySide6 UI components for MolSuite: smart table, project browser, job monitor, PyMOL dock, steppers.
|
|
5
5
|
Author: Mario S. Valdés-Tresanco, Mario E. Valdés-Tresanco
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,6 +17,8 @@ Classifier: Environment :: X11 Applications :: Qt
|
|
|
17
17
|
Requires-Python: >=3.12
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
+
License-File: licenses/lucide-LICENSE.txt
|
|
21
|
+
License-File: licenses/qt-themes-LICENSE.txt
|
|
20
22
|
Requires-Dist: PySide6>=6.5
|
|
21
23
|
Provides-Extra: monitor
|
|
22
24
|
Requires-Dist: pydantic>=2.0; extra == "monitor"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
The CPU, memory and GPU icons in src/ms_components/ms_monitor/icons/ come from Lucide
|
|
2
|
+
(https://lucide.dev), distributed under the ISC License:
|
|
3
|
+
|
|
4
|
+
ISC License
|
|
5
|
+
|
|
6
|
+
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT).
|
|
7
|
+
All other copyright (c) for Lucide are held by Lucide Contributors 2022.
|
|
8
|
+
|
|
9
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose with or
|
|
10
|
+
without fee is hereby granted, provided that the above copyright notice and this permission
|
|
11
|
+
notice appear in all copies.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
|
14
|
+
SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
15
|
+
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
16
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
17
|
+
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
|
18
|
+
OF THIS SOFTWARE.
|
|
@@ -9,7 +9,7 @@ description = "PySide6 UI components for MolSuite: smart table, project browser,
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12"
|
|
11
11
|
license = "MIT"
|
|
12
|
-
license-files = ["LICENSE"]
|
|
12
|
+
license-files = ["LICENSE", "licenses/*"]
|
|
13
13
|
authors = [
|
|
14
14
|
{ name = "Mario S. Valdés-Tresanco" },
|
|
15
15
|
{ name = "Mario E. Valdés-Tresanco" },
|
|
@@ -52,7 +52,7 @@ Issues = "https://github.com/MolSuite/ms_components/issues"
|
|
|
52
52
|
package-dir = { "" = "src" }
|
|
53
53
|
|
|
54
54
|
[tool.setuptools.package-data]
|
|
55
|
-
ms_components = ["*.qss", "ms_table/icons/*.svg", "ms_pymol/icons/*.svg", "ms_dockwidget/resources/icons/*"]
|
|
55
|
+
ms_components = ["*.qss", "ms_table/icons/*.svg", "ms_pymol/icons/*.svg", "ms_monitor/icons/*.svg", "ms_dockwidget/resources/icons/*"]
|
|
56
56
|
|
|
57
57
|
[tool.setuptools.packages.find]
|
|
58
58
|
where = ["src"]
|
|
@@ -496,7 +496,11 @@ class JobDetail(QWidget):
|
|
|
496
496
|
self._left.set(format_duration(left), f"≈ {_clock(left)} · 5-min rate", hue)
|
|
497
497
|
pct = 100.0 * job.chunks_settled / total if total else job.progress
|
|
498
498
|
accent = _pal().color(QPalette.ColorRole.Highlight).name()
|
|
499
|
-
|
|
499
|
+
# What the chunks hold, in the application's unit, under the chunks every job has.
|
|
500
|
+
held = (f"{job.items_done:,}" + (f" / {job.items_total:,}" if job.items_total else "") + f" {job.items_unit}"
|
|
501
|
+
if job.items_unit else "")
|
|
502
|
+
self._progress.set(f"{job.chunks_done:,} / {total:,}" if total else f"{job.chunks_done:,}", held, accent,
|
|
503
|
+
unit="chunks" if job.items_unit else "")
|
|
500
504
|
self._pct.setText(f"{pct:.1f}%" if pct < 10 else f"{pct:.0f}%")
|
|
501
505
|
self._pct.setStyleSheet(f"color:{accent}; font-weight:650; font-size:12px;")
|
|
502
506
|
colors = _colors()
|
|
@@ -510,9 +514,9 @@ class JobDetail(QWidget):
|
|
|
510
514
|
if job.items_unit:
|
|
511
515
|
# Chunks lead: they are what every job has. What they hold is the line under it, in
|
|
512
516
|
# the application's unit (tasks and CPUs are in the header already).
|
|
513
|
-
items = format_speed(job.items_eps)
|
|
514
|
-
|
|
515
|
-
sub =
|
|
517
|
+
items = format_speed(job.items_eps)
|
|
518
|
+
items = items.replace("/", f" {job.items_unit}/") if "/" in items else f"{items} {job.items_unit}/min"
|
|
519
|
+
sub = items + (" · mean" if job.is_terminal else "")
|
|
516
520
|
else:
|
|
517
521
|
cpu = f" · {job.cpu_used:,} CPUs" if job.cpu_used else ""
|
|
518
522
|
sub = f"{job.tasks_running:,} tasks{cpu}" if not job.is_terminal else "mean over the run"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 21V3"/><path d="M2 5h18a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2.26"/><path d="M7 17v3a1 1 0 0 0 1 1h5a1 1 0 0 0 1-1v-3"/><circle cx="16" cy="11" r="2"/><circle cx="8" cy="11" r="2"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 19v-3"/><path d="M10 19v-3"/><path d="M14 19v-3"/><path d="M18 19v-3"/><path d="M8 11V9"/><path d="M16 11V9"/><path d="M12 11V9"/><path d="M2 15h20"/><path d="M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z"/></svg>
|
|
@@ -37,6 +37,9 @@ def counts_label(job: JobMonitorState) -> str:
|
|
|
37
37
|
tail = "" if took is None else f" · took {format_duration(took)}"
|
|
38
38
|
else:
|
|
39
39
|
tail = f" · {job.note or 'calculating…'}" if left is None else f" · {format_duration(left)} left"
|
|
40
|
+
if job.items_unit: # what the chunks hold, in the application's unit
|
|
41
|
+
held = f"{job.items_total:,}" if job.items_total else "?"
|
|
42
|
+
return f"{job.items_done:,}/{held} {job.items_unit}{tail}"
|
|
40
43
|
return f"{job.chunks_done:,}/{total}{tail}"
|
|
41
44
|
|
|
42
45
|
|
|
@@ -48,6 +48,7 @@ class JobMonitorState:
|
|
|
48
48
|
chunks_running: int = 0 # taken and not settled: running, carried in a task, or being written
|
|
49
49
|
tasks_running: int = 0 # what runs now, one worker each; <= chunks_running
|
|
50
50
|
cpu_used: int = 0 # the CPU tokens those tasks hold
|
|
51
|
+
asked: dict = field(default_factory=dict) # what it asked of a queue: nodes, cpus, memory_gb, gpus (each node)
|
|
51
52
|
unreachable: str = "" # what its other machine has not answered since, while it does not
|
|
52
53
|
note: str = "" # what its source says it is at, while it runs (a campaign: in the queue, how far there)
|
|
53
54
|
canceling: bool = False # canceled, waiting for its other machine to stop it there
|
|
@@ -31,6 +31,7 @@ def job_state(job, now: float) -> JobMonitorState:
|
|
|
31
31
|
# ms_flow < 0.7 does not tell them apart: every chunk in flight reads as running.
|
|
32
32
|
tasks_running=getattr(job, "tasks_running", job.chunks_inflight),
|
|
33
33
|
cpu_used=getattr(job, "cpu_used", 0),
|
|
34
|
+
asked=getattr(job, "asked", None) or {}, # an older ms_flow does not say
|
|
34
35
|
unreachable=getattr(job, "unreachable", None) or "",
|
|
35
36
|
note=getattr(job, "note", None) or "", # an older ms_flow does not say
|
|
36
37
|
canceling=getattr(job, "canceling", False),
|
|
@@ -12,17 +12,21 @@ each one now.
|
|
|
12
12
|
"""
|
|
13
13
|
from __future__ import annotations
|
|
14
14
|
|
|
15
|
+
import html
|
|
15
16
|
import os
|
|
16
17
|
import shutil
|
|
17
18
|
import subprocess
|
|
18
19
|
import threading
|
|
19
20
|
import time
|
|
20
21
|
import urllib.request
|
|
21
|
-
from collections import deque
|
|
22
|
+
from collections import Counter, deque
|
|
22
23
|
from dataclasses import dataclass, field
|
|
23
24
|
|
|
24
|
-
from
|
|
25
|
-
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
from PySide6.QtCore import QByteArray, QObject, QPointF, QRectF, Qt, Signal
|
|
28
|
+
from PySide6.QtGui import QColor, QPainter, QPainterPath, QPalette, QPen, QPixmap
|
|
29
|
+
from PySide6.QtSvg import QSvgRenderer
|
|
26
30
|
from PySide6.QtWidgets import (QFrame, QGridLayout, QHBoxLayout, QLabel, QScrollArea, QStackedWidget, QToolButton,
|
|
27
31
|
QToolTip, QVBoxLayout, QWidget)
|
|
28
32
|
|
|
@@ -33,6 +37,12 @@ from ms_components.theme import color
|
|
|
33
37
|
INTERVALS = {"local": 5, "ray": 15, "queue": 30}
|
|
34
38
|
_HISTORY = 120 # reads kept per host: 10 min of this machine, 30 of one over the network
|
|
35
39
|
|
|
40
|
+
_ICONS = Path(__file__).with_name("icons")
|
|
41
|
+
# What a queue's jobs ask of it, shown as an icon, a number and what it is on hover.
|
|
42
|
+
_ASKED = (("cpu", "CPUs", "CPUs asked of the queue by its active jobs (CPUs of each node times its nodes)"),
|
|
43
|
+
("memory", "GB", "Memory asked of the queue by its active jobs (of each node times its nodes)"),
|
|
44
|
+
("gpu", "GPUs", "GPUs asked of the queue by its active jobs (of each node times its nodes)"))
|
|
45
|
+
|
|
36
46
|
_GPU_QUERY = "nvidia-smi --query-gpu=utilization.gpu,memory.used,memory.total --format=csv,noheader,nounits"
|
|
37
47
|
# macOS has no /proc: the CPU its processes use now (`ps`, 100 = one core), and memory from
|
|
38
48
|
# `sysctl` and `vm_stat` (free + inactive + speculative pages), said the way Linux says it.
|
|
@@ -40,6 +50,10 @@ _MAC = ("n=$(sysctl -n hw.ncpu); ps -A -o %cpu= | awk -v n=$n '{s += $1} END {pr
|
|
|
40
50
|
"echo \"MemTotal: $(($(sysctl -n hw.memsize) / 1024)) kB\"; "
|
|
41
51
|
"vm_stat | awk '/page size of/ {p = $8} /^Pages (free|inactive|speculative):/ {a += $NF} "
|
|
42
52
|
"END {printf \"MemAvailable: %d kB\\n\", a * p / 1024}'")
|
|
53
|
+
# What a host is, read once: the name of its CPU, its threads, the name of each card.
|
|
54
|
+
_HARDWARE = ("grep -m1 'model name' /proc/cpuinfo 2>/dev/null || echo \"model name: $(sysctl -n machdep.cpu.brand_string)\"; "
|
|
55
|
+
"echo \"threads: $(nproc 2>/dev/null || sysctl -n hw.ncpu)\"; "
|
|
56
|
+
"nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | sed 's/^/gpu: /'; true")
|
|
43
57
|
_SCRIPT = (f"if [ -r /proc/stat ]; then head -1 /proc/stat; grep -E '^(MemTotal|MemAvailable):' /proc/meminfo; "
|
|
44
58
|
f"else {_MAC}; fi; {_GPU_QUERY} 2>/dev/null || true")
|
|
45
59
|
|
|
@@ -54,6 +68,38 @@ class Sample:
|
|
|
54
68
|
error: str = ""
|
|
55
69
|
via: str = "" # "Ray" when its metrics said it
|
|
56
70
|
nodes: list[dict] = field(default_factory=list) # a queue's: see `ms_flow.remote.read_nodes`
|
|
71
|
+
hardware: dict = field(default_factory=dict) # `cpu` (its name), `threads`, `gpus` (a name per card)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def parse_hardware(text: str) -> dict:
|
|
75
|
+
"""What `_HARDWARE` printed."""
|
|
76
|
+
said: dict = {"gpus": []}
|
|
77
|
+
for line in text.splitlines():
|
|
78
|
+
key, _, value = (part.strip() for part in line.partition(":"))
|
|
79
|
+
if key == "model name" and value:
|
|
80
|
+
said["cpu"] = value
|
|
81
|
+
elif key == "threads" and value.isdigit():
|
|
82
|
+
said["threads"] = int(value)
|
|
83
|
+
elif key == "gpu" and value:
|
|
84
|
+
said["gpus"].append(value)
|
|
85
|
+
return said
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def hardware_lines(sample: Sample) -> list[str]:
|
|
89
|
+
"""What a machine has, for the hover of its card: CPU, memory, each kind of card."""
|
|
90
|
+
hardware, lines = sample.hardware, []
|
|
91
|
+
cpu = " · ".join(filter(None, (hardware.get("cpu", ""), f"{hardware['threads']} threads" if hardware.get("threads") else "")))
|
|
92
|
+
if cpu:
|
|
93
|
+
lines.append(f"<b>CPU</b> {html.escape(cpu)}")
|
|
94
|
+
if sample.mem_total_gb:
|
|
95
|
+
lines.append(f"<b>Memory</b> {sample.mem_total_gb:.0f} GB")
|
|
96
|
+
names = hardware.get("gpus") or []
|
|
97
|
+
cards = Counter()
|
|
98
|
+
for index in range(max(len(names), len(sample.gpus))):
|
|
99
|
+
total = sample.gpus[index][2] if index < len(sample.gpus) else 0.0
|
|
100
|
+
cards[(names[index] if index < len(names) else "GPU") + (f" · {total / 1024:.0f} GB" if total else "")] += 1
|
|
101
|
+
lines += [f"<b>GPU</b> {f'{n}× ' if n > 1 else ''}{html.escape(card)}" for card, n in cards.items()]
|
|
102
|
+
return lines
|
|
57
103
|
|
|
58
104
|
|
|
59
105
|
def from_nodes(nodes: list[dict]) -> Sample:
|
|
@@ -80,9 +126,15 @@ def parse_metrics(text: str) -> Sample:
|
|
|
80
126
|
if name in ("ray_node_gpus_utilization", "ray_node_gram_used", "ray_node_gram_available"):
|
|
81
127
|
index = labels.split('GpuIndex="', 1)[-1].split('"', 1)[0]
|
|
82
128
|
gpus.setdefault(index, {})[name] = float(value)
|
|
129
|
+
if 'GpuDeviceName="' in labels:
|
|
130
|
+
gpus[index]["name"] = labels.split('GpuDeviceName="', 1)[1].split('"', 1)[0]
|
|
83
131
|
else:
|
|
84
132
|
got.setdefault(name, float(value))
|
|
85
133
|
sample = Sample(cpu=got.get("ray_node_cpu_utilization"), via="Ray")
|
|
134
|
+
if got.get("ray_node_cpu_count"):
|
|
135
|
+
sample.hardware["threads"] = int(got["ray_node_cpu_count"])
|
|
136
|
+
if any("name" in gpu for gpu in gpus.values()):
|
|
137
|
+
sample.hardware["gpus"] = [gpu.get("name", "GPU") for _index, gpu in sorted(gpus.items())]
|
|
86
138
|
total = got.get("ray_node_mem_total", 0.0)
|
|
87
139
|
if total:
|
|
88
140
|
sample.mem_total_gb, sample.mem_used_gb = total / 1024**3, got.get("ray_node_mem_used", 0.0) / 1024**3
|
|
@@ -137,7 +189,7 @@ class _Reader:
|
|
|
137
189
|
# `metrics()` gives the URL of the host's Ray metrics, or None while no Ray has it;
|
|
138
190
|
# `nodes()`, those of the queue the host is the login node of
|
|
139
191
|
self.address, self._ticks, self._psutil, self._metrics, self._url = address, None, None, metrics, None
|
|
140
|
-
self._nodes = nodes
|
|
192
|
+
self._nodes, self._hardware = nodes, None
|
|
141
193
|
if not address:
|
|
142
194
|
try:
|
|
143
195
|
import psutil
|
|
@@ -148,6 +200,25 @@ class _Reader:
|
|
|
148
200
|
pass
|
|
149
201
|
|
|
150
202
|
def read(self) -> Sample:
|
|
203
|
+
sample = self._read()
|
|
204
|
+
if not sample.error and self._nodes is None: # a queue's nodes say theirs
|
|
205
|
+
if self._hardware is None and sample.via != "Ray": # Ray's metrics say it, with no ssh
|
|
206
|
+
self._hardware = self._read_hardware()
|
|
207
|
+
sample.hardware = {**(self._hardware or {}), **sample.hardware}
|
|
208
|
+
return sample
|
|
209
|
+
|
|
210
|
+
def _read_hardware(self) -> dict:
|
|
211
|
+
"""Read once: a machine does not change its CPU. Nothing, if it cannot be read."""
|
|
212
|
+
try:
|
|
213
|
+
if not self.address:
|
|
214
|
+
return parse_hardware(subprocess.run(["sh", "-c", _HARDWARE], capture_output=True, text=True, timeout=10).stdout)
|
|
215
|
+
from ms_env import Host
|
|
216
|
+
|
|
217
|
+
return parse_hardware(Host(self.address).run(_HARDWARE, timeout=30).decode(errors="replace"))
|
|
218
|
+
except Exception: # noqa: BLE001 - the hover only says less
|
|
219
|
+
return {}
|
|
220
|
+
|
|
221
|
+
def _read(self) -> Sample:
|
|
151
222
|
try:
|
|
152
223
|
if self._nodes is not None:
|
|
153
224
|
nodes = self._nodes()
|
|
@@ -180,9 +251,10 @@ class Sparkline(QWidget):
|
|
|
180
251
|
|
|
181
252
|
_TOP = 18 # the label row
|
|
182
253
|
|
|
183
|
-
def __init__(self, title: str, parent=None):
|
|
254
|
+
def __init__(self, title: str, parent=None, *, icon: str = "", tip: str = ""):
|
|
184
255
|
super().__init__(parent)
|
|
185
256
|
self.title, self.values, self.interval, self.note = title, deque(maxlen=_HISTORY), 5, ""
|
|
257
|
+
self.icon, self.tip = icon, tip # drawn before the name; what the measure is, over the label row
|
|
186
258
|
self.setMinimumSize(120, 70)
|
|
187
259
|
self.setMouseTracking(True)
|
|
188
260
|
|
|
@@ -203,8 +275,13 @@ class Sparkline(QWidget):
|
|
|
203
275
|
small = p.font()
|
|
204
276
|
small.setPixelSize(11)
|
|
205
277
|
p.setFont(small)
|
|
206
|
-
|
|
207
|
-
p.
|
|
278
|
+
faint = pal.color(QPalette.ColorRole.PlaceholderText)
|
|
279
|
+
p.setPen(faint)
|
|
280
|
+
left = 0
|
|
281
|
+
if self.icon:
|
|
282
|
+
p.drawPixmap(0, 0, _icon(self.icon, faint.name(), top - 4, self.devicePixelRatioF()))
|
|
283
|
+
left = top
|
|
284
|
+
p.drawText(left, 0, w - left, top - 4, Qt.AlignLeft | Qt.AlignVCenter, self.title)
|
|
208
285
|
now = next((v for v in reversed(self.values) if v is not None), None)
|
|
209
286
|
small.setBold(True)
|
|
210
287
|
p.setFont(small)
|
|
@@ -237,6 +314,9 @@ class Sparkline(QWidget):
|
|
|
237
314
|
p.drawPolyline(points)
|
|
238
315
|
|
|
239
316
|
def mouseMoveEvent(self, event):
|
|
317
|
+
if event.position().y() < self._TOP and self.tip:
|
|
318
|
+
QToolTip.showText(event.globalPosition().toPoint(), self.tip, self)
|
|
319
|
+
return
|
|
240
320
|
index = round(event.position().x() / max(1.0, self.width()) * (_HISTORY - 1)) - (_HISTORY - len(self.values))
|
|
241
321
|
if 0 <= index < len(self.values) and self.values[index] is not None:
|
|
242
322
|
ago = (len(self.values) - 1 - index) * self.interval
|
|
@@ -264,8 +344,9 @@ class _HostCard(QFrame):
|
|
|
264
344
|
self.setProperty("checked", False)
|
|
265
345
|
self.setMinimumWidth(380)
|
|
266
346
|
self.setCursor(Qt.PointingHandCursor)
|
|
267
|
-
self.
|
|
268
|
-
|
|
347
|
+
self._where = (f"{address or 'this computer'} · in {', '.join(self.executors) or 'no executor'}"
|
|
348
|
+
+ (f" · read every {interval}s" if interval else ""))
|
|
349
|
+
self._tip(None)
|
|
269
350
|
box = QVBoxLayout(self)
|
|
270
351
|
box.setContentsMargins(12, 8, 12, 10)
|
|
271
352
|
box.setSpacing(6)
|
|
@@ -292,20 +373,18 @@ class _HostCard(QFrame):
|
|
|
292
373
|
charts = QHBoxLayout(page)
|
|
293
374
|
charts.setContentsMargins(0, 0, 0, 0)
|
|
294
375
|
charts.setSpacing(12)
|
|
295
|
-
taken = " taken" if self.queue else ""
|
|
296
|
-
self.cpu, self.mem, self.gpu = (Sparkline(f"CPU{taken}", page), Sparkline(f"Memory{taken}", page),
|
|
297
|
-
Sparkline(f"GPU{taken}", page))
|
|
298
|
-
for chart in (self.cpu, self.mem, self.gpu):
|
|
299
|
-
chart.interval = interval or 0
|
|
300
|
-
charts.addWidget(chart, 1)
|
|
301
|
-
self.gpu.setVisible(False) # until a read finds one
|
|
302
376
|
self.pages.addWidget(page)
|
|
303
|
-
self.
|
|
304
|
-
|
|
305
|
-
|
|
377
|
+
if self.queue:
|
|
378
|
+
# A queue is shared: by default, what its jobs asked of it; behind "Nodes", each node and
|
|
379
|
+
# what every job has taken of it (Overall / per CPU, as system monitors do).
|
|
380
|
+
self.asked = {}
|
|
381
|
+
for icon, unit, tip in _ASKED:
|
|
382
|
+
self.asked[icon] = cell = _Asked(icon, unit, tip, page)
|
|
383
|
+
charts.addWidget(cell, 1)
|
|
306
384
|
listed = QScrollArea(self.pages)
|
|
307
385
|
listed.setWidgetResizable(True)
|
|
308
386
|
listed.setFrameShape(QFrame.NoFrame)
|
|
387
|
+
listed.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) # the rows elide nothing; a narrow card cuts the load
|
|
309
388
|
listed.setStyleSheet("QScrollArea { background: transparent; } QScrollArea > QWidget > QWidget { background: transparent; }")
|
|
310
389
|
self.node_rows = QWidget(listed)
|
|
311
390
|
self.node_grid = QGridLayout(self.node_rows)
|
|
@@ -317,11 +396,22 @@ class _HostCard(QFrame):
|
|
|
317
396
|
self.toggle = QToolButton(self)
|
|
318
397
|
self.toggle.setText("Nodes")
|
|
319
398
|
self.toggle.setCheckable(True)
|
|
320
|
-
self.toggle.setToolTip("Each node of the queue
|
|
399
|
+
self.toggle.setToolTip("Each node of the queue, or what its jobs asked of it (the default)")
|
|
321
400
|
self.toggle.setCursor(Qt.ArrowCursor)
|
|
322
401
|
self.toggle.setStyleSheet("QToolButton { font-size:11px; padding:0 6px; }")
|
|
323
402
|
self.toggle.toggled.connect(lambda on: self.pages.setCurrentIndex(int(on)))
|
|
324
403
|
head.addWidget(self.toggle)
|
|
404
|
+
else:
|
|
405
|
+
self.cpu, self.mem, self.gpu = (
|
|
406
|
+
Sparkline("CPU", page, icon="cpu", tip="CPU use of the whole machine, by every program on it"),
|
|
407
|
+
Sparkline("Memory", page, icon="memory", tip="Memory (RAM) in use on the machine, by every program on it"),
|
|
408
|
+
Sparkline("GPU", page, icon="gpu", tip="GPU use: the mean over the machine's cards"))
|
|
409
|
+
for chart in (self.cpu, self.mem, self.gpu):
|
|
410
|
+
chart.interval = interval or 0
|
|
411
|
+
charts.addWidget(chart, 1)
|
|
412
|
+
self.gpu.setVisible(False) # until a read finds one
|
|
413
|
+
self.pages.setVisible(interval is not None)
|
|
414
|
+
box.addWidget(self.pages, 1)
|
|
325
415
|
self.said = QLabel("not read: the login node of a queue" if interval is None else "", self)
|
|
326
416
|
self.said.setStyleSheet("color:palette(placeholder-text); font-size:11px;")
|
|
327
417
|
self.said.setVisible(interval is None)
|
|
@@ -341,8 +431,18 @@ class _HostCard(QFrame):
|
|
|
341
431
|
said.append(f"via {sample.via}")
|
|
342
432
|
self.about.setText(" · ".join(said))
|
|
343
433
|
|
|
344
|
-
def
|
|
434
|
+
def _tip(self, sample: Sample | None) -> None:
|
|
435
|
+
"""The hover of the card: where it is, then what it has (a queue: its nodes)."""
|
|
436
|
+
lines = [html.escape(self._where)]
|
|
437
|
+
if sample is not None:
|
|
438
|
+
lines += [queue_summary(sample.nodes)] if self.queue else hardware_lines(sample)
|
|
439
|
+
self.setToolTip("<br>".join(lines + ["<i>Click: only its jobs</i>"]))
|
|
440
|
+
|
|
441
|
+
def set_jobs(self, active: int, cpus: int, asked: dict | None = None) -> None:
|
|
345
442
|
self.jobs.setText(f"{active} active job{'s' * (active != 1)}" + (f" · {cpus:,} CPUs in use" if cpus else ""))
|
|
443
|
+
if self.queue:
|
|
444
|
+
for icon, cell in self.asked.items():
|
|
445
|
+
cell.set((asked or {}).get(icon, 0))
|
|
346
446
|
|
|
347
447
|
def set_checked(self, checked: bool) -> None:
|
|
348
448
|
self.setProperty("checked", checked)
|
|
@@ -360,16 +460,15 @@ class _HostCard(QFrame):
|
|
|
360
460
|
self.said.setText(sample.error)
|
|
361
461
|
return
|
|
362
462
|
self._describe(sample)
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
self.cpu.push(sample.cpu, f"{used:,}/{cpus:,}")
|
|
463
|
+
self._tip(sample)
|
|
464
|
+
if self.queue:
|
|
366
465
|
self._list(sample.nodes)
|
|
367
|
-
|
|
368
|
-
|
|
466
|
+
return
|
|
467
|
+
self.cpu.push(sample.cpu)
|
|
369
468
|
self.mem.push(sample.mem, f"{sample.mem_used_gb:.1f}/{sample.mem_total_gb:.0f} GB")
|
|
370
469
|
if sample.gpus: # ponytail: the mean over the cards; one chart per card when a host has several that differ
|
|
371
470
|
util = sum(g[0] for g in sample.gpus) / len(sample.gpus)
|
|
372
|
-
self.gpu.title = f"GPU
|
|
471
|
+
self.gpu.title = f"GPU {len(sample.gpus)}×"
|
|
373
472
|
self.gpu.push(util)
|
|
374
473
|
self.gpu.setVisible(True)
|
|
375
474
|
|
|
@@ -383,16 +482,91 @@ class _HostCard(QFrame):
|
|
|
383
482
|
cells = [("●", f"color:{color(hue).name()}; font-size:9px;"), (node["name"], "font-size:11.5px; font-weight:600;"),
|
|
384
483
|
(node["state"], faint), (f"{node['cpus_used']}/{node['cpus']} CPUs", "font-size:11px;"),
|
|
385
484
|
(f"{node['mem_used_gb']:.0f}/{node['mem_gb']:.0f} GB", "font-size:11px;"),
|
|
386
|
-
(
|
|
485
|
+
(_gpus(node), "font-size:11px;"),
|
|
387
486
|
("" if node["load"] is None else f"load {node['load']:.2f}", faint)]
|
|
388
487
|
for column, (text, style) in enumerate(cells):
|
|
389
488
|
label = QLabel(text, self.node_rows)
|
|
390
489
|
label.setStyleSheet(style)
|
|
391
490
|
self.node_grid.addWidget(label, row, column)
|
|
392
|
-
self.node_grid.setColumnStretch(
|
|
491
|
+
self.node_grid.setColumnStretch(7, 1)
|
|
393
492
|
self.node_grid.setRowStretch(len(nodes), 1)
|
|
394
493
|
|
|
395
494
|
|
|
495
|
+
class _Asked(QWidget):
|
|
496
|
+
"""An icon and how much of one resource a queue's jobs asked; what it is, on hover."""
|
|
497
|
+
|
|
498
|
+
def __init__(self, icon: str, unit: str, tip: str, parent=None):
|
|
499
|
+
super().__init__(parent)
|
|
500
|
+
self.unit = unit
|
|
501
|
+
row = QHBoxLayout(self)
|
|
502
|
+
row.setContentsMargins(0, 0, 0, 0)
|
|
503
|
+
row.setSpacing(6)
|
|
504
|
+
self.icon = QLabel(self)
|
|
505
|
+
self.icon.setPixmap(_icon(icon, self.palette().color(QPalette.PlaceholderText).name(), 18,
|
|
506
|
+
self.devicePixelRatioF()))
|
|
507
|
+
self.value = QLabel(self)
|
|
508
|
+
self.value.setStyleSheet("font-size:15px; font-weight:650;")
|
|
509
|
+
row.addWidget(self.icon)
|
|
510
|
+
row.addWidget(self.value)
|
|
511
|
+
row.addStretch(1)
|
|
512
|
+
self.setToolTip(tip)
|
|
513
|
+
self.set(0)
|
|
514
|
+
|
|
515
|
+
def set(self, amount: float) -> None:
|
|
516
|
+
self.value.setText(f"{amount:,.0f} {self.unit}" if amount else f"– {self.unit}")
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
def _icon(name: str, color_hex: str, size: int, dpr: float) -> QPixmap:
|
|
520
|
+
svg = (_ICONS / f"{name}.svg").read_bytes().replace(b"currentColor", color_hex.encode())
|
|
521
|
+
pixmap = QPixmap(round(size * dpr), round(size * dpr))
|
|
522
|
+
pixmap.fill(Qt.transparent)
|
|
523
|
+
with QPainter(pixmap) as painter:
|
|
524
|
+
QSvgRenderer(QByteArray(svg)).render(painter)
|
|
525
|
+
pixmap.setDevicePixelRatio(dpr)
|
|
526
|
+
return pixmap
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
def queue_asked(jobs) -> dict:
|
|
530
|
+
"""What `jobs` (snapshots of one queue) ask of it, added up: `cpu`, `memory` (GB), `gpu`."""
|
|
531
|
+
total = {"cpu": 0, "memory": 0, "gpu": 0}
|
|
532
|
+
for job in jobs:
|
|
533
|
+
asked = getattr(job, "asked", None) or {}
|
|
534
|
+
nodes = int(asked.get("nodes") or 1)
|
|
535
|
+
for key, said in (("cpu", "cpus"), ("memory", "memory_gb"), ("gpu", "gpus")):
|
|
536
|
+
try:
|
|
537
|
+
total[key] += nodes * float(asked.get(said) or 0)
|
|
538
|
+
except (TypeError, ValueError): # a site's own form ("a100:2"): not added
|
|
539
|
+
pass
|
|
540
|
+
return total
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
# ponytail: a queue of more nodes than this lists the first ones; a scrolling popup if that hurts.
|
|
544
|
+
_LISTED_NODES = 40
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
def queue_summary(nodes: list[dict]) -> str:
|
|
548
|
+
"""The whole of a queue, for the hover of its card: its nodes, what everyone has taken of their
|
|
549
|
+
CPUs, memory and cards, then each node."""
|
|
550
|
+
if not nodes:
|
|
551
|
+
return "The queue lists no nodes"
|
|
552
|
+
up = sum(not _down(node["state"]) for node in nodes)
|
|
553
|
+
taken = lambda key: sum(node[key] for node in nodes) # noqa: E731
|
|
554
|
+
lines = [f"<b>{len(nodes)} node{'s' * (len(nodes) != 1)}</b>, {up} up · taken by every job of the queue:",
|
|
555
|
+
f"CPUs {taken('cpus_used'):,}/{taken('cpus'):,} · memory {taken('mem_used_gb'):,.0f}/{taken('mem_gb'):,.0f} GB"
|
|
556
|
+
+ (f" · GPUs {taken('gpus_used')}/{taken('gpus')}" if taken("gpus") else "")]
|
|
557
|
+
rows = "".join(
|
|
558
|
+
f"<tr><td>{node['name']}</td><td>{node['state']}</td><td>{node['cpus_used']}/{node['cpus']} CPUs</td>"
|
|
559
|
+
f"<td>{node['mem_used_gb']:.0f}/{node['mem_gb']:.0f} GB</td>"
|
|
560
|
+
f"<td>{_gpus(node)}</td></tr>"
|
|
561
|
+
for node in nodes[:_LISTED_NODES])
|
|
562
|
+
more = f"<br>+{len(nodes) - _LISTED_NODES} more" if len(nodes) > _LISTED_NODES else ""
|
|
563
|
+
return "<br>".join(lines) + f"<table cellspacing='6'>{rows}</table>{more}"
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def _gpus(node: dict) -> str:
|
|
567
|
+
return f"{node['gpus_used']}/{node['gpus']} GPUs" if node["gpus"] else ""
|
|
568
|
+
|
|
569
|
+
|
|
396
570
|
def _down(state: str) -> bool:
|
|
397
571
|
"""Slurm's `down`, `drained`, `fail`, `not_responding` (with their `*`); Grid Engine's `down`."""
|
|
398
572
|
return any(word in state for word in ("down", "drain", "fail", "not_responding", "unknown"))
|
|
@@ -482,7 +656,7 @@ class HostsStrip(QScrollArea):
|
|
|
482
656
|
self._jobs = jobs
|
|
483
657
|
for card in self._cards.values():
|
|
484
658
|
mine = [job for job in jobs if not job.is_terminal and job.executor in card.executors]
|
|
485
|
-
card.set_jobs(len(mine), sum(job.cpu_used or 0 for job in mine))
|
|
659
|
+
card.set_jobs(len(mine), sum(job.cpu_used or 0 for job in mine), queue_asked(mine))
|
|
486
660
|
|
|
487
661
|
def stop(self) -> None:
|
|
488
662
|
self._stop.set() # daemons: each ends at its next wake-up, an ssh call in flight included
|
|
@@ -546,4 +720,5 @@ def workspace_hosts(workspace) -> list[tuple[str, str, str, list[str], int | Non
|
|
|
546
720
|
return [tuple(row) for row in rows.values()]
|
|
547
721
|
|
|
548
722
|
|
|
549
|
-
__all__ = ["HostsStrip", "INTERVALS", "Sample", "Sparkline", "from_nodes", "parse", "parse_metrics", "
|
|
723
|
+
__all__ = ["HostsStrip", "INTERVALS", "Sample", "Sparkline", "from_nodes", "parse", "parse_metrics", "queue_asked",
|
|
724
|
+
"queue_summary", "workspace_hosts"]
|
|
@@ -8,6 +8,7 @@ from PySide6.QtWidgets import (
|
|
|
8
8
|
QApplication,
|
|
9
9
|
QFrame,
|
|
10
10
|
QHBoxLayout,
|
|
11
|
+
QInputDialog,
|
|
11
12
|
QLabel,
|
|
12
13
|
QMessageBox,
|
|
13
14
|
QProgressDialog,
|
|
@@ -249,6 +250,20 @@ class ProjectsMenuWidget(QFrame):
|
|
|
249
250
|
return
|
|
250
251
|
self.refresh()
|
|
251
252
|
|
|
253
|
+
def _confirm_open_project_delete(self, project: ProjectItem) -> bool:
|
|
254
|
+
"""The project open now goes only once its name is typed: the application closes it,
|
|
255
|
+
restarts without it, then deletes its folder with everything in it."""
|
|
256
|
+
typed, ok = QInputDialog.getText(
|
|
257
|
+
self, "Delete the open project",
|
|
258
|
+
f"'{project.name}' is the project open now. The application closes it, restarts without it "
|
|
259
|
+
f"and deletes its folder with all its data and results:\n{project.path}\n\n"
|
|
260
|
+
"Jobs of this project that are still running are stopped.\n\n"
|
|
261
|
+
"Type the name of the project to delete it:")
|
|
262
|
+
if ok and typed.strip() != project.name:
|
|
263
|
+
QMessageBox.information(self, "Delete the open project",
|
|
264
|
+
f"The name did not match: '{project.name}' was not deleted.")
|
|
265
|
+
return ok and typed.strip() == project.name
|
|
266
|
+
|
|
252
267
|
def _on_delete(self, projects: list[ProjectItem]) -> None:
|
|
253
268
|
if not projects:
|
|
254
269
|
return
|
|
@@ -264,7 +279,8 @@ class ProjectsMenuWidget(QFrame):
|
|
|
264
279
|
in_use = [p for p in projects if self.active_project_id and str(p.id) == self.active_project_id]
|
|
265
280
|
projects = [p for p in projects if p not in in_use]
|
|
266
281
|
for project in in_use:
|
|
267
|
-
self.
|
|
282
|
+
if self._confirm_open_project_delete(project):
|
|
283
|
+
self.active_project_delete_requested.emit(str(project.id))
|
|
268
284
|
if not projects:
|
|
269
285
|
return
|
|
270
286
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ms_components
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.8
|
|
4
4
|
Summary: PySide6 UI components for MolSuite: smart table, project browser, job monitor, PyMOL dock, steppers.
|
|
5
5
|
Author: Mario S. Valdés-Tresanco, Mario E. Valdés-Tresanco
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,6 +17,8 @@ Classifier: Environment :: X11 Applications :: Qt
|
|
|
17
17
|
Requires-Python: >=3.12
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
19
19
|
License-File: LICENSE
|
|
20
|
+
License-File: licenses/lucide-LICENSE.txt
|
|
21
|
+
License-File: licenses/qt-themes-LICENSE.txt
|
|
20
22
|
Requires-Dist: PySide6>=6.5
|
|
21
23
|
Provides-Extra: monitor
|
|
22
24
|
Requires-Dist: pydantic>=2.0; extra == "monitor"
|
|
@@ -8,6 +8,7 @@ zensical.toml
|
|
|
8
8
|
.github/workflows/publish.yml
|
|
9
9
|
examples/tutorial_demo.py
|
|
10
10
|
examples/tutorial_demo.toml
|
|
11
|
+
licenses/lucide-LICENSE.txt
|
|
11
12
|
licenses/qt-themes-LICENSE.txt
|
|
12
13
|
src/ms_components/__init__.py
|
|
13
14
|
src/ms_components/backdrop.py
|
|
@@ -48,6 +49,9 @@ src/ms_components/ms_monitor/palette.py
|
|
|
48
49
|
src/ms_components/ms_monitor/polling.py
|
|
49
50
|
src/ms_components/ms_monitor/resources.py
|
|
50
51
|
src/ms_components/ms_monitor/widget.py
|
|
52
|
+
src/ms_components/ms_monitor/icons/cpu.svg
|
|
53
|
+
src/ms_components/ms_monitor/icons/gpu.svg
|
|
54
|
+
src/ms_components/ms_monitor/icons/memory.svg
|
|
51
55
|
src/ms_components/ms_projects/__init__.py
|
|
52
56
|
src/ms_components/ms_projects/app.py
|
|
53
57
|
src/ms_components/ms_projects/backend.py
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"docs/usage.md",
|
|
19
19
|
"examples/tutorial_demo.py",
|
|
20
20
|
"examples/tutorial_demo.toml",
|
|
21
|
+
"licenses/lucide-LICENSE.txt",
|
|
21
22
|
"licenses/qt-themes-LICENSE.txt",
|
|
22
23
|
"pyproject.toml",
|
|
23
24
|
"src/ms_components/__init__.py",
|
|
@@ -38,6 +39,9 @@
|
|
|
38
39
|
"src/ms_components/ms_monitor/config.py",
|
|
39
40
|
"src/ms_components/ms_monitor/detail.py",
|
|
40
41
|
"src/ms_components/ms_monitor/formatting.py",
|
|
42
|
+
"src/ms_components/ms_monitor/icons/cpu.svg",
|
|
43
|
+
"src/ms_components/ms_monitor/icons/gpu.svg",
|
|
44
|
+
"src/ms_components/ms_monitor/icons/memory.svg",
|
|
41
45
|
"src/ms_components/ms_monitor/jobs.py",
|
|
42
46
|
"src/ms_components/ms_monitor/models.py",
|
|
43
47
|
"src/ms_components/ms_monitor/palette.py",
|