ms-components 0.5.4__tar.gz → 0.5.6__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.4 → ms_components-0.5.6}/PKG-INFO +3 -3
- {ms_components-0.5.4 → ms_components-0.5.6}/pyproject.toml +2 -2
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/base.qss +1 -1
- ms_components-0.5.6/src/ms_components/labels.py +36 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_executors.py +129 -12
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/bridge.py +14 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/detail.py +90 -19
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/jobs.py +14 -4
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/models.py +4 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/polling.py +4 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/resources.py +113 -21
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/widget.py +12 -1
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/widget.py +14 -38
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/smart_table_view.py +6 -1
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/PKG-INFO +3 -3
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/SOURCES.txt +2 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/requires.txt +2 -2
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/scm_file_list.json +2 -0
- ms_components-0.5.6/src/ms_components.egg-info/scm_version.json +8 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_executors_ui.py +75 -3
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_molsuite_monitor_bridge.py +44 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_molsuite_monitor_widgets.py +47 -2
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_pymol_grid.py +20 -9
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_pymol_toolbar.py +12 -7
- ms_components-0.5.6/tests/test_table_autofill_lifecycle.py +41 -0
- ms_components-0.5.4/src/ms_components.egg-info/scm_version.json +0 -8
- {ms_components-0.5.4 → ms_components-0.5.6}/.github/workflows/docs.yml +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/.github/workflows/publish.yml +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/.gitignore +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/LICENSE +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/MANIFEST.in +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/README.md +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/examples/tutorial_demo.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/examples/tutorial_demo.toml +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/licenses/qt-themes-LICENSE.txt +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/setup.cfg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/backdrop.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/chips.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ketcher.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/listview.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_dockwidget/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_dockwidget/resources/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_dockwidget/resources/icons/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_dockwidget/resources/icons/folder.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_dockwidget/widget.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/config.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/formatting.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_monitor/palette.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/app.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/backend.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/browser.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/scratch.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_projects/widget.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/command_line.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/actions.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/box.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/center.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/display.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/export.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/hide.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/hydrogens-polar.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/hydrogens.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/menu.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/orient.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/presets.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/rock.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/save.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/selection.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/settings.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/style.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/icons/zoom.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/plugins.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_pymol/scene.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_settings/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_settings/panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_stepper.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/action_header.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/cell_delegate.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/column_panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/example_usage.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/filter_panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/columns.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/export.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/filter.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/menu.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/reload.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/search.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/settings.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/sort-asc.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/sort-desc.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/icons/sort.svg +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/metric_filter_bar.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/pagination_control.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/query_builder.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/session_provider.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/sort_panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/table_config.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/table_interaction.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/table_model.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/test_external_filters.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_table/test_toolbar.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_tutorial/__init__.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_tutorial/bindings.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_tutorial/controller.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_tutorial/models.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/ms_tutorial/overlay.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/opengl.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/pagination.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/palettes.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/step_dialog.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/theme.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/tool_panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components/wheel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/dependency_links.txt +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/src/ms_components.egg-info/top_level.txt +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/conftest.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_app_settings.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_chips.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_dock_window.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_ketcher.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_monitor_config.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_ms_projects_widget.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_opengl.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_optional_integrations.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_progress_column.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_project_browser.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_pymol_command_line.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_pymol_scene.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_query_builder_keyset.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_shift_hscroll.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_split_button_style.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_step_dialog.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_table_interaction.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_table_toolbar.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_table_view_state.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_theme_contrast.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_tool_panel.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/tests/test_tutorial.py +0 -0
- {ms_components-0.5.4 → ms_components-0.5.6}/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.6
|
|
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
|
|
@@ -21,11 +21,11 @@ Requires-Dist: PySide6>=6.5
|
|
|
21
21
|
Provides-Extra: monitor
|
|
22
22
|
Requires-Dist: pydantic>=2.0; extra == "monitor"
|
|
23
23
|
Provides-Extra: projects
|
|
24
|
-
Requires-Dist: ms_flow>=0.
|
|
24
|
+
Requires-Dist: ms_flow>=0.10.0; extra == "projects"
|
|
25
25
|
Provides-Extra: pymol
|
|
26
26
|
Requires-Dist: pymol-open-source>=3.2.0a0; extra == "pymol"
|
|
27
27
|
Provides-Extra: steps
|
|
28
|
-
Requires-Dist: ms_env>=0.4.
|
|
28
|
+
Requires-Dist: ms_env>=0.4.1; extra == "steps"
|
|
29
29
|
Provides-Extra: table
|
|
30
30
|
Requires-Dist: sqlmodel>=0.0.14; extra == "table"
|
|
31
31
|
Provides-Extra: all
|
|
@@ -31,9 +31,9 @@ dependencies = [
|
|
|
31
31
|
|
|
32
32
|
[project.optional-dependencies]
|
|
33
33
|
monitor = ["pydantic>=2.0"]
|
|
34
|
-
projects = ["ms_flow>=0.
|
|
34
|
+
projects = ["ms_flow>=0.10.0"]
|
|
35
35
|
pymol = ["pymol-open-source>=3.2.0a0"]
|
|
36
|
-
steps = ["ms_env>=0.4.
|
|
36
|
+
steps = ["ms_env>=0.4.1"]
|
|
37
37
|
table = ["sqlmodel>=0.0.14"]
|
|
38
38
|
all = ["ms_components[monitor,projects,pymol,steps,table]"]
|
|
39
39
|
# Test + development tooling.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""Labels shared by the components."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from PySide6.QtCore import QSize, Qt
|
|
5
|
+
from PySide6.QtWidgets import QLabel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ElidedLabel(QLabel):
|
|
9
|
+
"""A label that never widens its row: what does not fit ends in an ellipsis. `text()` is the
|
|
10
|
+
whole text."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, text: str = "", parent=None) -> None:
|
|
13
|
+
super().__init__(parent)
|
|
14
|
+
self._full = ""
|
|
15
|
+
self.setText(text)
|
|
16
|
+
|
|
17
|
+
def setText(self, text: str) -> None: # noqa: N802
|
|
18
|
+
self._full = str(text)
|
|
19
|
+
self.updateGeometry()
|
|
20
|
+
self._elide()
|
|
21
|
+
|
|
22
|
+
def text(self) -> str:
|
|
23
|
+
return self._full
|
|
24
|
+
|
|
25
|
+
def sizeHint(self) -> QSize: # noqa: N802
|
|
26
|
+
return QSize(self.fontMetrics().horizontalAdvance(self._full) + 4, super().sizeHint().height())
|
|
27
|
+
|
|
28
|
+
def minimumSizeHint(self) -> QSize: # noqa: N802
|
|
29
|
+
return QSize(0, super().minimumSizeHint().height())
|
|
30
|
+
|
|
31
|
+
def resizeEvent(self, event) -> None: # noqa: N802
|
|
32
|
+
super().resizeEvent(event)
|
|
33
|
+
self._elide()
|
|
34
|
+
|
|
35
|
+
def _elide(self) -> None:
|
|
36
|
+
super().setText(self.fontMetrics().elidedText(self._full, Qt.ElideRight, self.width()))
|
|
@@ -22,9 +22,11 @@ from PySide6.QtWidgets import (
|
|
|
22
22
|
QComboBox,
|
|
23
23
|
QDialog,
|
|
24
24
|
QDoubleSpinBox,
|
|
25
|
+
QFileDialog,
|
|
25
26
|
QFormLayout,
|
|
26
27
|
QGridLayout,
|
|
27
28
|
QHBoxLayout,
|
|
29
|
+
QInputDialog,
|
|
28
30
|
QLabel,
|
|
29
31
|
QLineEdit,
|
|
30
32
|
QListWidget,
|
|
@@ -40,8 +42,18 @@ from PySide6.QtWidgets import (
|
|
|
40
42
|
)
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
# Fields written a line each: a queue's `module` commands and the site's own lines.
|
|
46
|
+
_LINES = ("modules", "setup")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _editor(field, value: Any, parent: QWidget, names=(), lines: bool = False) -> QWidget:
|
|
44
50
|
annotation, options = field.annotation, get_args(field.annotation)
|
|
51
|
+
if lines:
|
|
52
|
+
editor = QPlainTextEdit("\n".join(value or []) if isinstance(value, list) else str(value or ""), parent)
|
|
53
|
+
editor.setProperty("lines", list if get_origin(annotation) is list else str)
|
|
54
|
+
editor.setPlaceholderText("load gcc/12" if get_origin(annotation) is list else "export OMP_NUM_THREADS=1")
|
|
55
|
+
editor.setMaximumHeight(90)
|
|
56
|
+
return editor
|
|
45
57
|
if get_origin(annotation) in (Union, types.UnionType) and options == (bool, type(None)):
|
|
46
58
|
editor = QComboBox(parent)
|
|
47
59
|
for text, data in (("Automatic", None), ("Yes", True), ("No", False)):
|
|
@@ -90,6 +102,10 @@ def _value(editor: QWidget) -> Any:
|
|
|
90
102
|
if isinstance(editor, QListWidget):
|
|
91
103
|
items = [editor.item(row) for row in range(editor.count())]
|
|
92
104
|
return [item.data(Qt.ItemDataRole.UserRole) for item in items if item.checkState() == Qt.CheckState.Checked]
|
|
105
|
+
if isinstance(editor, QPlainTextEdit) and editor.property("lines") is list:
|
|
106
|
+
return [line.strip() for line in editor.toPlainText().splitlines() if line.strip()]
|
|
107
|
+
if isinstance(editor, QPlainTextEdit) and editor.property("lines") is str:
|
|
108
|
+
return editor.toPlainText().strip()
|
|
93
109
|
if isinstance(editor, QPlainTextEdit):
|
|
94
110
|
pairs = (line.partition("=") for line in editor.toPlainText().splitlines() if "=" in line)
|
|
95
111
|
return {key.strip(): path.strip() for key, _, path in pairs}
|
|
@@ -195,6 +211,8 @@ class KeptPage(QWidget):
|
|
|
195
211
|
changed = Signal()
|
|
196
212
|
_checked = Signal(str)
|
|
197
213
|
_synced = Signal(str, bool) # a line said there, and whether it is the last
|
|
214
|
+
_question = Signal(str) # what ssh asks while connecting, to answer here
|
|
215
|
+
_connected = Signal(str, bool) # what came of it, and whether it got in
|
|
198
216
|
|
|
199
217
|
def __init__(self, workspace, table: str, parent: QWidget | None = None, *, packages=("ms_flow", "ms_env"),
|
|
200
218
|
default_env: str = "", programs=()):
|
|
@@ -237,10 +255,15 @@ class KeptPage(QWidget):
|
|
|
237
255
|
self.check_button.setToolTip("Log in to it and say what it is and what it has: system, CPUs, GPUs, "
|
|
238
256
|
"the environment of the app and its packages, the tools named.")
|
|
239
257
|
self.check_button.clicked.connect(self._check)
|
|
258
|
+
self.connect_button = QPushButton("Connect…", self)
|
|
259
|
+
self.connect_button.setToolTip("Log in to it once with its password: the app puts a key of its own there, "
|
|
260
|
+
"so jobs get in alone. The password is kept nowhere.")
|
|
261
|
+
self.connect_button.clicked.connect(self._connect)
|
|
262
|
+
foot.addWidget(self.connect_button)
|
|
240
263
|
foot.addWidget(self.check_button)
|
|
241
264
|
self.sync_button = QPushButton("Sync", self)
|
|
242
265
|
self.sync_button.setToolTip("Install there, or bring up to date, the environment of the app and the "
|
|
243
|
-
"programs ticked
|
|
266
|
+
"programs ticked (the form is saved first). What is already as it is here is left alone.")
|
|
244
267
|
self.sync_button.clicked.connect(self._sync)
|
|
245
268
|
foot.addWidget(self.sync_button)
|
|
246
269
|
self.steps = _Steps(self)
|
|
@@ -251,6 +274,15 @@ class KeptPage(QWidget):
|
|
|
251
274
|
self._right.addWidget(self.report, 8) # the room the stretch below has while nothing is said
|
|
252
275
|
self._checked.connect(self._show_report)
|
|
253
276
|
self._synced.connect(self._sync_said)
|
|
277
|
+
self._question.connect(self._answer)
|
|
278
|
+
self._connected.connect(self._connect_said)
|
|
279
|
+
self._answered, self._answer_given = threading.Event(), None
|
|
280
|
+
if table == "executors":
|
|
281
|
+
self.site_button = QPushButton("Read site script…", self)
|
|
282
|
+
self.site_button.setToolTip("Fill the fields of a queue from a job script of the site: its #SBATCH lines, "
|
|
283
|
+
"its module commands and the lines that prepare the environment.")
|
|
284
|
+
self.site_button.clicked.connect(self._read_site)
|
|
285
|
+
foot.addWidget(self.site_button)
|
|
254
286
|
foot.addWidget(self.save_button)
|
|
255
287
|
self._right.addStretch(1)
|
|
256
288
|
self._right.addLayout(foot)
|
|
@@ -293,7 +325,7 @@ class KeptPage(QWidget):
|
|
|
293
325
|
self._editors = {}
|
|
294
326
|
for key, field in self._model.model_fields.items():
|
|
295
327
|
names = self._programs if key == "install" else hosts
|
|
296
|
-
editor = self._editors[key] = _editor(field, getattr(entry, key, None), body, names)
|
|
328
|
+
editor = self._editors[key] = _editor(field, getattr(entry, key, None), body, names, key in _LINES)
|
|
297
329
|
editor.setToolTip(field.description or "")
|
|
298
330
|
form.addRow(field.title or key.replace("_", " ").capitalize(), editor)
|
|
299
331
|
if "install" in self._editors: # this machine has its programs from the app's own settings
|
|
@@ -315,6 +347,7 @@ class KeptPage(QWidget):
|
|
|
315
347
|
self.report.setVisible(False)
|
|
316
348
|
self.steps.setVisible(False)
|
|
317
349
|
self.sync_button.setVisible(bool(name) and name != "local" and getattr(self._workspace, "host_env", None) is not None)
|
|
350
|
+
self.connect_button.setVisible(name != "local")
|
|
318
351
|
self._right.insertWidget(0, body)
|
|
319
352
|
|
|
320
353
|
def _only_of_kind(self) -> None:
|
|
@@ -323,8 +356,31 @@ class KeptPage(QWidget):
|
|
|
323
356
|
only = (field.json_schema_extra or {}).get("kind")
|
|
324
357
|
self._form.setRowVisible(self._editors[key], only in (None, kind))
|
|
325
358
|
self._form.labelForField(self._editors["hosts"]).setText("Login node" if kind == "queue" else "Hosts")
|
|
359
|
+
self.site_button.setVisible(kind == "queue")
|
|
326
360
|
self._one_host()
|
|
327
361
|
|
|
362
|
+
def _read_site(self) -> None:
|
|
363
|
+
"""The fields of the queue as a site's script says them (`ms_flow.site_script.read`); saved when
|
|
364
|
+
the user saves."""
|
|
365
|
+
from ms_flow.site_script import read
|
|
366
|
+
|
|
367
|
+
path, _ = QFileDialog.getOpenFileName(self, "Read site script", "", "Job scripts (*.sh *.slurm *.sbatch);;All files (*)")
|
|
368
|
+
if not path:
|
|
369
|
+
return
|
|
370
|
+
with open(path, encoding="utf-8", errors="replace") as script:
|
|
371
|
+
fields = read(script.read())
|
|
372
|
+
dropped = fields.pop("dropped")
|
|
373
|
+
for key, value in fields.items():
|
|
374
|
+
editor = self._editors.get(key)
|
|
375
|
+
if isinstance(editor, QPlainTextEdit):
|
|
376
|
+
editor.setPlainText("\n".join(value) if isinstance(value, list) else value)
|
|
377
|
+
elif isinstance(editor, (QSpinBox, QDoubleSpinBox)):
|
|
378
|
+
editor.setValue(value)
|
|
379
|
+
elif isinstance(editor, QLineEdit):
|
|
380
|
+
editor.setText(value)
|
|
381
|
+
self.said.setText("Read; save to keep it." + (" Left out (the job runs ms_flow's runner, and sets these itself): "
|
|
382
|
+
+ "; ".join(dropped) if dropped else ""))
|
|
383
|
+
|
|
328
384
|
def _one_host(self, ticked: QListWidgetItem | None = None) -> None:
|
|
329
385
|
"""A queue is asked through one machine, its login node, and has nothing to do with
|
|
330
386
|
the others kept: ticking one unticks the rest."""
|
|
@@ -339,20 +395,21 @@ class KeptPage(QWidget):
|
|
|
339
395
|
item.setCheckState(Qt.CheckState.Unchecked)
|
|
340
396
|
ticks.blockSignals(False)
|
|
341
397
|
|
|
342
|
-
def _save(self) ->
|
|
398
|
+
def _save(self) -> bool:
|
|
343
399
|
name = self.name.text().strip()
|
|
344
400
|
if not self.name.isReadOnly() and name in self._kept():
|
|
345
401
|
self.said.setText(f"`{name}` is kept already.")
|
|
346
|
-
return
|
|
402
|
+
return False
|
|
347
403
|
fields = {key: _value(editor) for key, editor in self._editors.items() if not editor.isHidden()}
|
|
348
404
|
try:
|
|
349
405
|
getattr(self._workspace, f"save_{self._one}")(name, **fields)
|
|
350
406
|
except (ValueError, RuntimeError) as error:
|
|
351
407
|
self.said.setText(str(error))
|
|
352
|
-
return
|
|
408
|
+
return False
|
|
353
409
|
self.reload(select=name)
|
|
354
410
|
self.said.setText(f"`{name}` is kept.")
|
|
355
411
|
self.changed.emit()
|
|
412
|
+
return True
|
|
356
413
|
|
|
357
414
|
def _check(self) -> None:
|
|
358
415
|
"""What `describe_host` says of the host as the form has it now, saved or not."""
|
|
@@ -371,19 +428,74 @@ class KeptPage(QWidget):
|
|
|
371
428
|
|
|
372
429
|
threading.Thread(target=work, name="host-check", daemon=True).start()
|
|
373
430
|
|
|
431
|
+
def _connect(self) -> None:
|
|
432
|
+
"""`ms_env.connect` the host by the name in the form, to the machine asked for; its address
|
|
433
|
+
becomes that name, saved."""
|
|
434
|
+
name = self.name.text().strip()
|
|
435
|
+
if not name:
|
|
436
|
+
self.said.setText("Name the host first: ssh will know the machine by that name.")
|
|
437
|
+
return
|
|
438
|
+
address = self._editors["address"].text().strip()
|
|
439
|
+
target, ok = QInputDialog.getText(self, "Connect", "Log in to (user@machine, or user@machine:port):",
|
|
440
|
+
text=address if "@" in address else "")
|
|
441
|
+
if not ok or not target.strip():
|
|
442
|
+
return
|
|
443
|
+
self.connect_button.setEnabled(False)
|
|
444
|
+
self._show_report(f"Logging in to {target.strip()}…")
|
|
445
|
+
|
|
446
|
+
def work() -> None:
|
|
447
|
+
from ms_env import connect # ms_env is the `steps` extra
|
|
448
|
+
|
|
449
|
+
try:
|
|
450
|
+
how = connect(name, target, self._ask)
|
|
451
|
+
except Exception as error: # noqa: BLE001 - said in the page, where it was asked for
|
|
452
|
+
self._connected.emit(f"Could not connect to {target.strip()}:\n{error}", False)
|
|
453
|
+
return
|
|
454
|
+
self._connected.emit(
|
|
455
|
+
f"`{name}` gets in with a key of its own from now on." if how == "key" else
|
|
456
|
+
f"`{name}` asks for more than a key, so the login stays open for 8 hours: jobs go through it. "
|
|
457
|
+
"Connect again when it ends.", True)
|
|
458
|
+
|
|
459
|
+
threading.Thread(target=work, name="host-connect", daemon=True).start()
|
|
460
|
+
|
|
461
|
+
def _ask(self, question: str) -> str | None:
|
|
462
|
+
"""What the user answers to `question`, asked on the GUI thread; called on another one."""
|
|
463
|
+
self._answered.clear()
|
|
464
|
+
self._question.emit(question)
|
|
465
|
+
self._answered.wait()
|
|
466
|
+
return self._answer_given
|
|
467
|
+
|
|
468
|
+
def _answer(self, question: str) -> None:
|
|
469
|
+
if "(yes/no" in question: # whether to trust the machine's key: ssh takes "yes"
|
|
470
|
+
asked = QMessageBox.question(self, "Connect", question)
|
|
471
|
+
self._answer_given = "yes" if asked == QMessageBox.StandardButton.Yes else None
|
|
472
|
+
else: # a password or a code: not shown while typed
|
|
473
|
+
text, ok = QInputDialog.getText(self, "Connect", question, QLineEdit.EchoMode.Password)
|
|
474
|
+
self._answer_given = text if ok else None
|
|
475
|
+
self._answered.set()
|
|
476
|
+
|
|
477
|
+
def _connect_said(self, text: str, got_in: bool) -> None:
|
|
478
|
+
self.connect_button.setEnabled(True)
|
|
479
|
+
if got_in: # saving shows the form again: what came of it is said after
|
|
480
|
+
self._editors["address"].setText(self.name.text().strip())
|
|
481
|
+
self._save()
|
|
482
|
+
self._show_report(text)
|
|
483
|
+
|
|
374
484
|
def _sync(self, *_, unlock=None) -> None:
|
|
375
485
|
"""`Workspace.host_env` for the host as it is saved: what the app prepares there, made as it is here.
|
|
376
486
|
`unlock` first removes the lock of an environment there that the user said was left behind."""
|
|
377
487
|
name = self.names.currentItem().text()
|
|
378
|
-
host = self._kept()[name]
|
|
379
|
-
if host.env:
|
|
380
|
-
self._show_report(f"`{name}` names its own environment, {host.env}: the app prepares nothing there.")
|
|
381
|
-
return
|
|
382
488
|
users = [row["name"] for row in self._workspace.executors()
|
|
383
489
|
if row["state"] in ("on", "starting") and name in row["hosts"]]
|
|
384
490
|
if users: # what it runs would change under it
|
|
385
491
|
self._show_report(f"`{name}` is in use by `{users[0]}`, which is active: deactivate it first.")
|
|
386
492
|
return
|
|
493
|
+
if unlock is None and not self._save(): # the form as it is now: its ticks are what gets installed
|
|
494
|
+
return
|
|
495
|
+
host = self._kept()[name]
|
|
496
|
+
if host.env:
|
|
497
|
+
self._show_report(f"`{name}` names its own environment, {host.env}: the app prepares nothing there.")
|
|
498
|
+
return
|
|
387
499
|
self.sync_button.setEnabled(False)
|
|
388
500
|
self._show_report(f"Preparing {host.address}…")
|
|
389
501
|
|
|
@@ -443,7 +555,7 @@ class ExecutorsPanel(QDialog):
|
|
|
443
555
|
"""
|
|
444
556
|
|
|
445
557
|
line, ended = Signal(str), Signal(str, str)
|
|
446
|
-
settings_requested = Signal()
|
|
558
|
+
settings_requested = Signal(str) # the executor to open Settings on; "" for the pages
|
|
447
559
|
_STATES = {"on": "On", "off": "Off", "starting": "Starting…", "blocked": "Blocked"}
|
|
448
560
|
|
|
449
561
|
def __init__(self, workspace, parent: QWidget | None = None):
|
|
@@ -472,7 +584,7 @@ class ExecutorsPanel(QDialog):
|
|
|
472
584
|
foot.addStretch(1)
|
|
473
585
|
self.settings_button = QPushButton("Hosts and executors…", self)
|
|
474
586
|
self.settings_button.setToolTip("They are made and changed in Settings.")
|
|
475
|
-
self.settings_button.clicked.connect(self.settings_requested.emit)
|
|
587
|
+
self.settings_button.clicked.connect(lambda: self.settings_requested.emit(""))
|
|
476
588
|
foot.addWidget(self.settings_button)
|
|
477
589
|
self._layout.addLayout(foot)
|
|
478
590
|
|
|
@@ -526,6 +638,11 @@ class ExecutorsPanel(QDialog):
|
|
|
526
638
|
button.setToolTip(row["why"])
|
|
527
639
|
button.clicked.connect(lambda _checked, name=name, stop=state == "on": self._do(name, stop))
|
|
528
640
|
grid.addWidget(button, at, 5)
|
|
641
|
+
edit = QPushButton("Edit…", body)
|
|
642
|
+
edit.setToolTip("Its CPUs, memory, partition… in Settings; what does not change how it connects "
|
|
643
|
+
"is changed while it is active too.")
|
|
644
|
+
edit.clicked.connect(lambda _checked, name=name: self.settings_requested.emit(name))
|
|
645
|
+
grid.addWidget(edit, at, 6)
|
|
529
646
|
self._layout.insertWidget(0, body)
|
|
530
647
|
|
|
531
648
|
def _default(self, name: str) -> None:
|
|
@@ -144,6 +144,20 @@ class MolSuiteMonitorBridge(QObject):
|
|
|
144
144
|
self.operator_action_succeeded.emit("cancel_job", job_id)
|
|
145
145
|
return True
|
|
146
146
|
|
|
147
|
+
def reconnect_job(self, job_id: str) -> bool:
|
|
148
|
+
"""Ask the other machine of a job that waits for it again now."""
|
|
149
|
+
job = self._visible_job(job_id)
|
|
150
|
+
if job is None or job.engine_id is None or not job.unreachable:
|
|
151
|
+
self._emit_action_failed("reconnect_job", f"Job '{job_id}' is not waiting for a host here.")
|
|
152
|
+
return False
|
|
153
|
+
try:
|
|
154
|
+
self._workspace.engine.reconnect(job.engine_id)
|
|
155
|
+
except Exception as exc:
|
|
156
|
+
self._emit_action_failed("reconnect_job", str(exc))
|
|
157
|
+
return False
|
|
158
|
+
self.operator_action_succeeded.emit("reconnect_job", job_id)
|
|
159
|
+
return True
|
|
160
|
+
|
|
147
161
|
def job_destinations(self, job_id: str) -> list[str]:
|
|
148
162
|
"""The executors the job recorded as `job_id` may be continued on: none for a job that
|
|
149
163
|
cannot be submitted again."""
|
|
@@ -37,8 +37,8 @@ from PySide6.QtWidgets import (
|
|
|
37
37
|
)
|
|
38
38
|
|
|
39
39
|
from ms_components.ms_monitor.formatting import format_duration, format_speed
|
|
40
|
-
from ms_components.ms_monitor.jobs import status_color
|
|
41
|
-
from ms_components.ms_monitor.models import FailureState, JobMonitorState
|
|
40
|
+
from ms_components.ms_monitor.jobs import badge_of, status_color
|
|
41
|
+
from ms_components.ms_monitor.models import FailureState, JobMonitorState, TaskMonitorState
|
|
42
42
|
from ms_components.ms_monitor.palette import P
|
|
43
43
|
from ms_components.theme import font
|
|
44
44
|
|
|
@@ -422,7 +422,7 @@ class JobDetail(QWidget):
|
|
|
422
422
|
self._traceback.setReadOnly(True)
|
|
423
423
|
self._traceback.setLineWrapMode(QPlainTextEdit.NoWrap)
|
|
424
424
|
self._traceback.setFont(font(mono=True))
|
|
425
|
-
errors = QSplitter(Qt.Vertical, side)
|
|
425
|
+
self._errors_tab = errors = QSplitter(Qt.Vertical, side)
|
|
426
426
|
errors.addWidget(self._errors)
|
|
427
427
|
errors.addWidget(self._traceback)
|
|
428
428
|
errors.setSizes([260, 140])
|
|
@@ -433,9 +433,17 @@ class JobDetail(QWidget):
|
|
|
433
433
|
self._facts.setColumnStretch(1, 1)
|
|
434
434
|
self._facts.setRowStretch(len(self._FACTS), 1)
|
|
435
435
|
self._build_summary()
|
|
436
|
+
self._steps = QTreeWidget(side)
|
|
437
|
+
self._steps.setHeaderLabels(["At", "Took", "Step"])
|
|
438
|
+
self._steps.setRootIsDecorated(False)
|
|
439
|
+
self._steps.setFrameShape(QFrame.NoFrame)
|
|
440
|
+
self._steps.header().setSectionResizeMode(QHeaderView.ResizeToContents)
|
|
441
|
+
self._steps.header().setStretchLastSection(True)
|
|
436
442
|
self._tabs.addTab(self._tasks, "Running")
|
|
437
443
|
self._tabs.addTab(errors, "Errors")
|
|
438
444
|
self._tabs.addTab(self._summary, "Summary")
|
|
445
|
+
self._tabs.addTab(self._steps, "Steps")
|
|
446
|
+
self._tabs.setTabVisible(self._tabs.indexOf(self._steps), False) # only a job whose source says its steps (a campaign)
|
|
439
447
|
self._errors.currentItemChanged.connect(self._show_traceback)
|
|
440
448
|
|
|
441
449
|
work.addWidget(grid_panel)
|
|
@@ -458,16 +466,19 @@ class JobDetail(QWidget):
|
|
|
458
466
|
self._bar.parts, self._trend.values = (0, 0, 0, 0), []
|
|
459
467
|
self._show_grid(None)
|
|
460
468
|
self._tasks.clear()
|
|
461
|
-
self._tabs.setTabText(
|
|
469
|
+
self._tabs.setTabText(self._tabs.indexOf(self._tasks), "Running")
|
|
462
470
|
self._tab_meta.setText("")
|
|
463
471
|
self.set_failures([], 0)
|
|
464
472
|
self._set_summary(None)
|
|
473
|
+
self._set_steps(None)
|
|
465
474
|
return
|
|
466
475
|
hue = status_color(job.status)
|
|
467
476
|
self._name.setText(job.name or job.job_id[:8])
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
self._badge.
|
|
477
|
+
badge, badge_hue = badge_of(job)
|
|
478
|
+
self._badge.setText(badge)
|
|
479
|
+
self._badge.setToolTip(job.unreachable)
|
|
480
|
+
back = QColor(badge_hue)
|
|
481
|
+
self._badge.setStyleSheet(f"color:{badge_hue}; background:rgba({back.red()},{back.green()},{back.blue()},30);"
|
|
471
482
|
" border-radius:4px; padding:1px 6px; font-size:10.5px; font-weight:650;")
|
|
472
483
|
self._chip.setText(job.executor or "")
|
|
473
484
|
self._chip.setVisible(bool(job.executor))
|
|
@@ -506,11 +517,34 @@ class JobDetail(QWidget):
|
|
|
506
517
|
self._show_grid(job)
|
|
507
518
|
self._set_tasks(job)
|
|
508
519
|
self._set_summary(job)
|
|
520
|
+
self._set_steps(job)
|
|
509
521
|
|
|
510
522
|
def set_color(self, color: str) -> None:
|
|
511
523
|
"""The job's own color, as the list paints it."""
|
|
512
524
|
self._swatch.setStyleSheet(f"background:{color}; border-radius:3px;")
|
|
513
525
|
|
|
526
|
+
def _set_steps(self, job: JobMonitorState | None) -> None:
|
|
527
|
+
"""Every step it went through, with how long it took: the next one's start, or now. A job
|
|
528
|
+
with steps (a campaign) has them as its first tab, shown when it is chosen."""
|
|
529
|
+
steps = job.steps if job is not None else ()
|
|
530
|
+
at = self._tabs.indexOf(self._steps)
|
|
531
|
+
if bool(steps) != (at == 0):
|
|
532
|
+
self._tabs.removeTab(at)
|
|
533
|
+
at = self._tabs.insertTab(0 if steps else self._tabs.count(), self._steps, "Steps")
|
|
534
|
+
self._tabs.setTabVisible(at, bool(steps))
|
|
535
|
+
chosen = job.job_id if job is not None else None
|
|
536
|
+
if steps and chosen != getattr(self, "_steps_of", None):
|
|
537
|
+
self._tabs.setCurrentIndex(at)
|
|
538
|
+
self._steps_of = chosen if steps else None
|
|
539
|
+
if not steps or (steps == getattr(self, "_shown_steps", None) and job.is_terminal):
|
|
540
|
+
return
|
|
541
|
+
self._shown_steps = steps
|
|
542
|
+
end = job.finished_at.timestamp() if job.finished_at else datetime.now().timestamp()
|
|
543
|
+
self._steps.clear()
|
|
544
|
+
for (at, line), (until, _next) in zip(steps, [*steps[1:], (end, "")]):
|
|
545
|
+
self._steps.addTopLevelItem(QTreeWidgetItem([f"{datetime.fromtimestamp(at):%H:%M:%S}",
|
|
546
|
+
_took(until - at), line]))
|
|
547
|
+
|
|
514
548
|
def _meta_text(self, job: JobMonitorState) -> str:
|
|
515
549
|
said = []
|
|
516
550
|
if job.started_at is not None:
|
|
@@ -518,6 +552,10 @@ class JobDetail(QWidget):
|
|
|
518
552
|
said.append(f"started {job.started_at:%H:%M} · elapsed {format_duration((end - job.started_at).total_seconds())}")
|
|
519
553
|
if not job.is_terminal and job.tasks_running:
|
|
520
554
|
said.append(f"{job.tasks_running:,} tasks" + (f" · {job.cpu_used:,} CPUs" if job.cpu_used else ""))
|
|
555
|
+
if job.note and not job.is_terminal:
|
|
556
|
+
said.append(job.note)
|
|
557
|
+
if job.unreachable and not job.is_terminal:
|
|
558
|
+
said.append(job.unreachable)
|
|
521
559
|
if job.engine_id is None:
|
|
522
560
|
said.append("not run by this session")
|
|
523
561
|
return " · ".join(said)
|
|
@@ -560,6 +598,10 @@ class JobDetail(QWidget):
|
|
|
560
598
|
|
|
561
599
|
def _set_tasks(self, job: JobMonitorState) -> None:
|
|
562
600
|
tasks = job.tasks
|
|
601
|
+
if not tasks and job.steps and not job.is_terminal: # a campaign: its job in the queue, as its source says it
|
|
602
|
+
since = job.steps[-1][0]
|
|
603
|
+
tasks = [TaskMonitorState(job.note or job.steps[-1][1], host=job.executor, progress=job.progress,
|
|
604
|
+
seconds=max(0.0, datetime.now().timestamp() - since))]
|
|
563
605
|
median = statistics.median(task.seconds for task in tasks) if len(tasks) >= 3 else None
|
|
564
606
|
warn = QColor(P["warn"])
|
|
565
607
|
while self._tasks.topLevelItemCount() > len(tasks):
|
|
@@ -578,7 +620,7 @@ class JobDetail(QWidget):
|
|
|
578
620
|
for column in range(5):
|
|
579
621
|
item.setForeground(column, warn if late else self._tasks.palette().color(QPalette.ColorRole.Text))
|
|
580
622
|
item.setToolTip(0, f"slow: {task.seconds / median:.1f}× the median" if late else task.input)
|
|
581
|
-
self._tabs.setTabText(
|
|
623
|
+
self._tabs.setTabText(self._tabs.indexOf(self._tasks), f"Running {len(tasks)}" if tasks else "Running")
|
|
582
624
|
said = [f"{len(tasks)} running"] if tasks else []
|
|
583
625
|
if median is not None:
|
|
584
626
|
said.append(f"median {format_duration(median)}")
|
|
@@ -620,8 +662,9 @@ class JobDetail(QWidget):
|
|
|
620
662
|
if self._errors.count():
|
|
621
663
|
self._errors.setCurrentRow(0)
|
|
622
664
|
count = failed + bool(job_error)
|
|
623
|
-
self._tabs.
|
|
624
|
-
self._tabs.
|
|
665
|
+
errors = self._tabs.indexOf(self._errors_tab)
|
|
666
|
+
self._tabs.setTabText(errors, f"Errors {count:,}" if count else "Errors")
|
|
667
|
+
self._tabs.tabBar().setTabTextColor(errors, QColor(P["error"]) if count else _pal().color(QPalette.ColorRole.Text))
|
|
625
668
|
self._set_failed_kpi()
|
|
626
669
|
|
|
627
670
|
def _show_traceback(self, item, _previous=None) -> None:
|
|
@@ -641,7 +684,7 @@ class JobDetail(QWidget):
|
|
|
641
684
|
self._fact["key"].setFont(font(mono=True))
|
|
642
685
|
copy = QPushButton("copy", self._summary)
|
|
643
686
|
copy.setObjectName("xchip")
|
|
644
|
-
copy.clicked.connect(lambda: QGuiApplication.clipboard().setText(self._fact["key"].
|
|
687
|
+
copy.clicked.connect(lambda: QGuiApplication.clipboard().setText(self._fact["key"].toolTip()))
|
|
645
688
|
self._facts.addWidget(copy, 0, 2)
|
|
646
689
|
|
|
647
690
|
def _set_summary(self, job: JobMonitorState | None) -> None:
|
|
@@ -660,20 +703,26 @@ class JobDetail(QWidget):
|
|
|
660
703
|
f"{job.chunks_done:,} done · {job.chunks_failed:,} failed · {job.chunks_total:,} in all",
|
|
661
704
|
f"{job.chunks_retried:,}",
|
|
662
705
|
format_speed(job.throughput_eps) + ("" if job.is_terminal else " · last 5 min"),
|
|
663
|
-
f"{job.peak_mem_mb:,} MB" if job.peak_mem_mb else "—",
|
|
664
706
|
*_used(job, (end - job.started_at).total_seconds() if job.started_at else 0.0),
|
|
665
707
|
f"{job.tasks_running:,} tasks · {job.cpu_used:,} CPUs" if not job.is_terminal else "—",
|
|
666
708
|
f"{self._error_types:,} types" if self._error_types else "none",
|
|
667
709
|
)
|
|
668
710
|
for key, value in zip(self._FACTS, values):
|
|
669
711
|
self._fact[key].setText(value)
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
712
|
+
# a key is a long hash: its first characters say which one it is, the whole on hover and to copy
|
|
713
|
+
self._fact["key"].setText(job.job_id[:8] + "…" if len(job.job_id) > 9 else job.job_id)
|
|
714
|
+
self._fact["key"].setToolTip(job.job_id)
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
def _used(job: JobMonitorState, seconds: float) -> tuple[str, str, str]:
|
|
718
|
+
"""The memory, CPU and GPU lines of a job's summary: what it kept busy, of what it held. A
|
|
719
|
+
campaign's job in a queue: what the queue's accounting says it used there."""
|
|
720
|
+
usage, memory = job.usage, f"{job.peak_mem_mb:,} MB" if job.peak_mem_mb else "—"
|
|
721
|
+
queue = (usage or {}).get("queue")
|
|
722
|
+
if queue:
|
|
723
|
+
return _queue_used(queue, memory)
|
|
675
724
|
if not usage or seconds <= 0:
|
|
676
|
-
return "—", "—"
|
|
725
|
+
return memory, "—", "—"
|
|
677
726
|
cpu = gpu = "—"
|
|
678
727
|
if usage.get("peak_cpu"):
|
|
679
728
|
held = f"{usage['cpu_s'] / seconds:,.1f} held on average · {usage['peak_cpu']:g} at most"
|
|
@@ -683,7 +732,29 @@ def _used(job: JobMonitorState, seconds: float) -> tuple[str, str]:
|
|
|
683
732
|
gpu = f"{usage['gpu_s'] / 3600:,.2f} GPU·h · {usage['peak_gpu']:g} at most"
|
|
684
733
|
if usage.get("vram_mb") is not None:
|
|
685
734
|
gpu += f" · {usage['vram_mb']:,} MB VRAM at most · {usage['gpu_util']:.0f} % busy on average"
|
|
686
|
-
return cpu, gpu
|
|
735
|
+
return memory, cpu, gpu
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
def _queue_used(queue: dict, memory: str) -> tuple[str, str, str]:
|
|
739
|
+
"""`_used` of a job in a queue, as seff says it: the CPU time over what was held, the memory
|
|
740
|
+
over what was asked for. Final once it ended there, else so far."""
|
|
741
|
+
so_far = "" if queue.get("final") else " so far"
|
|
742
|
+
there = f"in the queue (job {queue.get('job')}){so_far}"
|
|
743
|
+
cpu_s, cpus, wall = queue.get("cpu_s"), queue.get("cpus"), queue.get("wall_s")
|
|
744
|
+
cpu = f"{there}: —"
|
|
745
|
+
if cpu_s is not None:
|
|
746
|
+
cpu = f"{there}: {cpu_s / 3600:,.2f} CPU·h"
|
|
747
|
+
if cpus and wall:
|
|
748
|
+
cpu += f" · {cpu_s / (cpus * wall):.0%} of {cpus:,} CPUs busy over {format_duration(wall)}"
|
|
749
|
+
peak, asked = queue.get("peak_mem_mb"), queue.get("mem_mb")
|
|
750
|
+
if peak is not None:
|
|
751
|
+
memory = f"{peak:,.0f} MB at most{f' of {asked:,.0f} MB asked for' if asked else ''}, {there} · {memory} here"
|
|
752
|
+
return memory, cpu, "—"
|
|
687
753
|
|
|
688
754
|
|
|
689
755
|
__all__ = ["ChunkGrid", "GRID_MAX", "GRID_STEP", "JobDetail", "counts", "grid_window", "layout_cells", "reason"]
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
def _took(seconds: float) -> str:
|
|
759
|
+
"""A step's length: tenths under a minute, where the quick ones are."""
|
|
760
|
+
return f"{max(0.0, seconds):.1f}s" if seconds < 60 else format_duration(seconds)
|
|
@@ -36,10 +36,20 @@ def counts_label(job: JobMonitorState) -> str:
|
|
|
36
36
|
took = (job.finished_at - job.started_at).total_seconds() if job.finished_at and job.started_at else None
|
|
37
37
|
tail = "" if took is None else f" · took {format_duration(took)}"
|
|
38
38
|
else:
|
|
39
|
-
tail = " · calculating…" if left is None else f" · {format_duration(left)} left"
|
|
39
|
+
tail = f" · {job.note or 'calculating…'}" if left is None else f" · {format_duration(left)} left"
|
|
40
40
|
return f"{job.chunks_done:,}/{total}{tail}"
|
|
41
41
|
|
|
42
42
|
|
|
43
|
+
def badge_of(job) -> tuple[str, str]:
|
|
44
|
+
"""The badge of a job and its colour: a running job whose other machine does not answer
|
|
45
|
+
waits for it."""
|
|
46
|
+
if job.unreachable and not job.is_terminal:
|
|
47
|
+
return "WAITING FOR HOST", P["warn"]
|
|
48
|
+
if job.canceling and not job.is_terminal:
|
|
49
|
+
return "CANCELING", P["warn"]
|
|
50
|
+
return job.status.replace("_", " ").upper(), status_color(job.status)
|
|
51
|
+
|
|
52
|
+
|
|
43
53
|
class GlowBar(QWidget):
|
|
44
54
|
def __init__(self, value=0.0, status="running", parent=None):
|
|
45
55
|
super().__init__(parent)
|
|
@@ -146,10 +156,10 @@ class _JobRow(QStyledItemDelegate):
|
|
|
146
156
|
|
|
147
157
|
# the status, an uppercase badge on the right
|
|
148
158
|
p.setFont(tiny)
|
|
149
|
-
badge = job
|
|
159
|
+
badge, hue = badge_of(job)
|
|
150
160
|
bw = p.fontMetrics().horizontalAdvance(badge) + 12
|
|
151
161
|
brect = QRectF(right - bw, top + 1, bw, 16)
|
|
152
|
-
hue = QColor(
|
|
162
|
+
hue = QColor(hue)
|
|
153
163
|
back = QColor(hue)
|
|
154
164
|
back.setAlphaF(0.13)
|
|
155
165
|
p.setBrush(back)
|
|
@@ -291,4 +301,4 @@ class JobList(QListWidget):
|
|
|
291
301
|
self.item(i).setHidden(not shown)
|
|
292
302
|
|
|
293
303
|
|
|
294
|
-
__all__ = ["GlowBar", "JOB_HUES", "JobList", "counts_label", "status_color"]
|
|
304
|
+
__all__ = ["GlowBar", "JOB_HUES", "JobList", "badge_of", "counts_label", "status_color"]
|
|
@@ -48,6 +48,10 @@ 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
|
+
unreachable: str = "" # what its other machine has not answered since, while it does not
|
|
52
|
+
note: str = "" # what its source says it is at, while it runs (a campaign: in the queue, how far there)
|
|
53
|
+
canceling: bool = False # canceled, waiting for its other machine to stop it there
|
|
54
|
+
steps: tuple = () # every step its source went through, (epoch seconds, line), quick ones too
|
|
51
55
|
chunks_retried: int = 0
|
|
52
56
|
peak_mem_mb: int = 0
|
|
53
57
|
usage: dict = field(default_factory=dict) # what it used, kept once it ended: see ms_flow's JobSnapshot.usage
|
|
@@ -31,6 +31,10 @@ 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
|
+
unreachable=getattr(job, "unreachable", None) or "",
|
|
35
|
+
note=getattr(job, "note", None) or "", # an older ms_flow does not say
|
|
36
|
+
canceling=getattr(job, "canceling", False),
|
|
37
|
+
steps=tuple(getattr(job, "steps", ())),
|
|
34
38
|
chunks_retried=job.chunks_retried,
|
|
35
39
|
peak_mem_mb=job.peak_mem_mb,
|
|
36
40
|
usage=getattr(job, "usage", None) or {}, # ms_flow < 0.8 does not keep it
|