Repository navigation
Implement the Processes section on the Control page - #260
yakutovicha wants to merge 4 commits into
Conversation
|
Only comment here is perhaps to implement the scroll bar inside the container of the list. So red should be where blue is 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. |
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.
79de393 to
afaa582
Compare
cf5c595 to
ae56825
Compare
Fixes #255
Stacked on #258.
Replaces the
ProcessControlWidgetplaceholder with the process list (filtered by process state, default running + waiting, and by past days or "All days"), plus actions on selected processes: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 withprocess_list.ipynb):updatedcounter trait andcurrent_rows, a list of the displayed rows as plain dicts, so embedders can rebuild their options after every update.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_processesnever raise for per-process problems in AiiDA 2.9: "already terminated", "unreachable" and timeouts are only logged toaiida.process_control(ProcessTimeoutExceptionis 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.past_dayswould let ticking "All days" overwrite the day count with -1 (covered by a regression test).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 againstCalculationQueryBuilderand the query-error path.🤖 Generated with Claude Code