8000 Implement the Processes section on the Control page by yakutovicha · Pull Request #260 · aiidalab/aiidalab-home · GitHub
[go: up one dir, main page]

Skip to content

Implement the Processes section on the Control page - #260

Open
yakutovicha wants to merge 4 commits into
feature/storage-tabfrom
feature/processes-tab
Open

yakutovicha wants to merge 4 commits into
feature/storage-tabfrom
feature/processes-tab

Conversation

@yakutovicha
@yakutovicha yakutovicha commented Sep 28, 2026 •
Copy link
Copy Markdown
Member

Fixes #255

Stacked on #258.

Replaces the ProcessControlWidget placeholder with the process list (filtered by process state, default running + waiting, and by past days or "All days"), plus actions on selected processes:

  • A multi-select of the displayed processes ("PK | label | state"); the selection survives list refreshes.
  • Pause / Play / Kill, disabled while nothing is selected or an action runs. Kill needs a second click ("Confirm kill (N)") and disarms on any selection change, list update, or Pause/Play click.
  • Actions need a running daemon and are refused with a pointer to the Daemon tab otherwise.

Actions run on a background thread that loads the nodes itself from their PKs (AiiDA ORM objects must not cross threads, cf. #252) and collects per-PK load errors.

Changes to ProcessListWidget (shared with process_list.ipynb):

  • An updated counter trait and current_rows, a list of the displayed rows as plain dicts, so embedders can rebuild their options after every update.
  • The projected header labels as named constants.
  • A failing query now renders an inline error message instead of raising. This is the one behaviour change for process_list.ipynb, and an improvement there: a raising query used to end its autoupdate thread for good. The success path is unchanged.

Notes for review:

  • pause/play/kill_processes never raise for per-process problems in AiiDA 2.9: "already terminated", "unreachable" and timeouts are only logged to aiida.process_control (ProcessTimeoutException is only mentioned in docstrings). The section captures that log and shows it under the summary, so a kill of an already finished process says so instead of reporting success.
  • The past-days filter is fed one way, by observers on both controls. A two-way link between the day count and past_days would let ticking "All days" overwrite the day count with -1 (covered by a regression test).
  • Changing a filter does not re-query the list until Refresh or "Update now" is clicked, as in the reference design; a follow-up can make it automatic.
  • The section has both its own Refresh button and the list's "Update now" button, which do the same thing. I kept both for now; hiding one is a one-line change if preferred.

Tests

Option rebuilding, kill arming and the confirmed kill, the past-days wiring, the state filter, the daemon guard, the reported outcomes and the failure path; plus, in test_process.py, the header constants against CalculationQueryBuilder and the query-error path.

🤖 Generated with Claude Code

@edan-bainglass
edan-bainglass commented Sep 29, 2026 •
Copy link
Copy Markdown
Member

Only comment here is perhaps to implement the scroll bar inside the container of the list. So red should be where blue is

image

In addition, for performance, do you limit the number of hits? Great if we paginate this part. I strongly recommend you switch your ad-hoc component with table-widget. We already use it here and there. Great to standardize. I am considering to also replace the code table in the code setup notebook with this widget.

Matter of fact, if you do this, your actions panel below the table can move into column buttons, which are supported in table-widget. We can improve table-widget to support a dropdown of actions in the future (requested by @giovannipizzi). I pinged @superstar54 regarding long-term maintenance and potential transfer of the component to AiiDAlab.

@yakutovicha
yakutovicha removed this pull request from stack #263 October 23, 2026 10:30
Replace the ProcessControlWidget placeholder with a filtered process
list plus pause/play/kill actions on selected processes.

- Kill requires a confirming second click and disarms on any
  selection or list change. Actions need a running daemon and are
  refused with a pointer to the Daemon tab otherwise.
- Actions run on a background thread, which loads the nodes itself
  (AiiDA ORM objects must not cross threads) and collects per-PK load
  errors. AiiDA only logs the per-process outcome (e.g. already
  terminated, unreachable, timed out), so the aiida.process_control
  log is captured and shown.
- The past-days filter is fed one way, by observers on both the day
  count and the "All days" checkbox, so ticking the checkbox cannot
  overwrite the day count with -1.

ProcessListWidget grows an `updated` counter and a `current_rows`
snapshot of the plain (link-free) rows, so embedders can rebuild
their selection. The projected header labels become named constants,
and query failures now render as an inline message instead of
raising.

Add tests for option rebuilding, kill arming, the past-days wiring,
the daemon guard and the reported outcomes, and for the header
constants against CalculationQueryBuilder and the query-error path.
The kill test only checked that a first click arms the button and
that selection changes and list updates disarm it; a regression where
the confirming click never kills would have passed. Use stored nodes
so the worker can load them, stub the list update so it does not
disarm on its own, and also cover Pause disarming a pending kill.

Also correct the process_widget fixture docstring, which claimed a
stubbed list update the fixture does not set up.
_rebuild_options skipped rows without a parsable PK and defaulted the
label and state to empty strings. Every row carries these columns (the
header names are tested against CalculationQueryBuilder), so the guard
could only hide an upstream rename behind an empty "Act on" list.
Index the rows directly, so that such a change fails loudly instead.

Also show all six process states in the state filter without a
scrollbar (SelectMultiple defaults to five rows).

Covered by the existing option-rebuilding and kill tests.
current_rows held {"headers": [...], "rows": [...]}, but the only
consumer, the Processes tab, reads just the rows, and each row dict
is already keyed by the headers in column order. Store the list of
row dicts directly while the attribute is new and has no other users.

The test that checks the named header constants against
CalculationQueryBuilder now takes the headers from a row's keys.
@yakutovicha
yakutovicha force-pushed the feature/processes-tab branch from 79de393 to afaa582 Compare October 23, 2026 10:41
@yakutovicha
yakutovicha changed the base branch from feature/daemon-tab to feature/storage-tab October 23, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Control page: implement the Processes section

2 participants

0