Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Humanized process status view #1048

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c27055e
Draft1
edan-bainglass Jan 1, 2025
01d6907
Draft2
edan-bainglass Jan 1, 2025
6568b4c
Draft3
edan-bainglass Jan 1, 2025
bf6f383
Make the tree collapsible
edan-bainglass Jan 2, 2025
9a9e5b2
Fix indentation
edan-bainglass Jan 2, 2025
372c635
Draft calculation link to advanced view
edan-bainglass Jan 2, 2025
e1c792d
Add reset-to-root button
edan-bainglass Jan 3, 2025
291a8e4
Reduce tree indentation
edan-bainglass Jan 3, 2025
20c6774
Add collapse all button
edan-bainglass Jan 3, 2025
f37d759
Update styles
edan-bainglass Jan 3, 2025
5b33c00
Refactor
edan-bainglass Jan 3, 2025
dd7ca29
Expand root node by default
edan-bainglass Jan 3, 2025
825e96a
Cosmetics
edan-bainglass Jan 5, 2025
634023f
Lazy-load branches
edan-bainglass Jan 5, 2025
293e7cf
Improve tree node titles
edan-bainglass Jan 5, 2025
12c5c91
Relocate process tree classes
edan-bainglass Jan 6, 2025
ba5875f
Make total jobs count restart-aware
edan-bainglass Jan 6, 2025
783ba58
Store `LoadingWidget` message in a local variable for easy reference
edan-bainglass Jan 8, 2025
6ba62d8
Make AiiDA `ProcessNode` a requirement of process tree nodes
edan-bainglass Jan 8, 2025
b46f75a
Add `ProcessTreeBranches` class
edan-bainglass Jan 8, 2025
45108f8
Add tests
edan-bainglass Jan 8, 2025
8f801d5
Big changes
edan-bainglass Jan 9, 2025
31e5dff
Close but not quite there
edan-bainglass Jan 10, 2025
5379dec
Apply static solution to counts
edan-bainglass Jan 10, 2025
d33baff
Update tests
edan-bainglass Jan 10, 2025
712f1b3
Add node view to simplified process tree container
edan-bainglass Jan 10, 2025
b4f8aca
Fix test
edan-bainglass Jan 10, 2025
8275cc4
Minor changes
edan-bainglass Jan 10, 2025
f25b79d
Sort called children by `ctime`
edan-bainglass Jan 13, 2025
8fc2949
Improve styles
edan-bainglass Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 97 additions & 16 deletions src/aiidalab_qe/app/result/components/status/status.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import ipywidgets as ipw

from aiida import orm
Expand All @@ -7,6 +9,7 @@
from aiidalab_widgets_base.viewers import viewer as node_viewer

from .model import WorkChainStatusModel
from .tree import SimplifiedProcessTree, SimplifiedProcessTreeModel


class WorkChainStatusPanel(ResultsComponent[WorkChainStatusModel]):
Expand All @@ -15,14 +18,21 @@ def __init__(self, model: WorkChainStatusModel, **kwargs):
self.node_views = {} # node-view cache
self.node_view_loading_message = LoadingWidget("Loading node view")

def _on_monitor_counter_change(self, _):
self._update_process_tree()

def _on_node_selection_change(self, change):
self._update_node_view(change["new"])

def _render(self):
self.simplified_status_view = ipw.HTML("Coming soon")
model = SimplifiedProcessTreeModel()
self.simplified_process_tree = SimplifiedProcessTree(model=model)
ipw.dlink(
(self._model, "process_uuid"),
(model, "process_uuid"),
)
ipw.dlink(
(self._model, "monitor_counter"),
(model, "monitor_counter"),
)
model.observe(
self._on_calculation_link_click,
"clicked",
)

self.process_tree = ProcessNodesTreeWidget()
self.process_tree.observe(
Expand All @@ -34,19 +44,61 @@ def _render(self):
(self.process_tree, "value"),
)

self.node_view_container = ipw.VBox()
self.reset_button = ipw.Button(
description="Reset to root",
button_style="warning",
icon="refresh",
tooltip="Reseed the process tree with the root node",
layout=ipw.Layout(width="fit-content"),
)
self.reset_button.on_click(self._reset_process_tree)

self.node_view_container = ipw.VBox(layout=ipw.Layout(height="100%"))
self.node_view_container.add_class("node-view-container")

self.to_advanced_view_button = ipw.Button(
description="View in advanced panel",
button_style="primary",
icon="eye",
tooltip="Switch to the advanced view",
layout=ipw.Layout(width="fit-content"),
)
self.to_advanced_view_button.on_click(self._switch_to_advanced_view)

simplified_tree_container = ipw.VBox(
children=[self.simplified_process_tree],
)

simplified_tree_node_view_container = ipw.VBox(
children=[
self.to_advanced_view_button,
self.node_view_container,
],
)

simplified_view = ipw.Box(
children=[
simplified_tree_container,
simplified_tree_node_view_container,
]
)
simplified_view.add_class("simplified-view")

advanced_view = ipw.VBox(
children=[
self.reset_button,
self.process_tree,
self.node_view_container,
],
)
advanced_view.add_class("advanced-view")

self.accordion = ipw.Accordion(
children=[
self.simplified_status_view,
ipw.VBox(
children=[
self.process_tree,
self.node_view_container,
],
),
simplified_view,
advanced_view,
],
selected_index=1,
selected_index=None,
)
titles = [
"Status overview",
Expand All @@ -55,8 +107,32 @@ def _render(self):
for i, title in enumerate(titles):
self.accordion.set_title(i, title)

self.accordion.observe(
self._on_accordion_change,
"selected_index",
)

self.accordion.selected_index = 0

self.children = [self.accordion]

def _on_monitor_counter_change(self, _):
self._update_process_tree()

def _on_accordion_change(self, change):
if change["new"] == 0:
self.simplified_process_tree.render()

def _on_calculation_link_click(self, change):
if selected_node_uuid := change["new"]:
self.process_tree.value = selected_node_uuid

def _on_node_selection_change(self, change):
self._update_node_view(change["new"])

def _switch_to_advanced_view(self, _):
self.accordion.selected_index = 1

def _update_process_tree(self):
if self.rendered:
self.process_tree.update()
Expand Down Expand Up @@ -89,3 +165,8 @@ def _update_node_view(self, nodes, refresh=False):
self.node_view = ipw.HTML("No viewer available for this node.")

self.node_view_container.children = [self.node_view]

def _reset_process_tree(self, _):
if not self.rendered:
return
self.process_tree.value = self._model.process_uuid
Loading
Loading