Skip to content

add UserActions for bulk UserUpdateNodesAttrs#190

Merged
cmalinmayor merged 4 commits intomainfrom
user-update-nodes-attrs-bulk
Apr 7, 2026
Merged

add UserActions for bulk UserUpdateNodesAttrs#190
cmalinmayor merged 4 commits intomainfrom
user-update-nodes-attrs-bulk

Conversation

@TeunHuijben
Copy link
Copy Markdown
Collaborator

The group actions make heavy use of the UserUpdateNodeAttr actions. They loop over all nodes and apply the update user actions one-by-one, including the expensive tracks.refresh.

This PR makes a "bulk" version of this UserAction, to make that process faster.

(I needed this for the v2-branch, but as the functions are near-idential to main, might just as well change it on main, and pull into v2 😅)

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.11%. Comparing base (1738545) to head (812bb89).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #190      +/-   ##
==========================================
+ Coverage   91.07%   91.11%   +0.04%     
==========================================
  Files          59       60       +1     
  Lines        2923     2948      +25     
==========================================
+ Hits         2662     2686      +24     
- Misses        261      262       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TeunHuijben TeunHuijben marked this pull request as ready for review April 3, 2026 04:29
@TeunHuijben TeunHuijben requested a review from cmalinmayor April 3, 2026 04:29
nodes: The node ids to update.
attrs: A mapping from attribute name to new attribute values,
applied to all nodes.
attrs: Either a single dict applied to all nodes, or a list of dicts
Copy link
Copy Markdown
Contributor

@cmalinmayor cmalinmayor Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the API you want? Or, would it be better to have dict[str, list[values]] - one dictionary, one entry per attribute, with lists of values to cover all the nodes? In general, I'm open to having bulk BasicActions as well as the current singular ones, it seems like the User doing bulk things is happening more often than I thought

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I like that approach a lot! However, I can see problems distinguishing whether a list within the dict represents an array attribute or a series of single-value attributes ({"pos": [1, 2, 3]}), especially when the number of nodes equals the number of dimensions in pos. Any suggestion?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not allow the single-value entries for this one? Since we have the singular UserAction right? But that's a good point if we want to allow both. Plus, the dictionary approach allows updating different attributes per node, which is more flexible

Copy link
Copy Markdown
Contributor

@cmalinmayor cmalinmayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want your thoughts on the API and if we should make bulk basic actions before I approve - but in general, this change is good! Thank you 🎉 🦖

self,
tracks: SolutionTracks,
nodes: list[int],
attrs: dict[str, Any] | list[dict[str, Any]],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
attrs: dict[str, Any] | list[dict[str, Any]],
attrs: dict[str, list[Any]],

if you have one element explicitly, call singular version

@TeunHuijben
Copy link
Copy Markdown
Collaborator Author

@cmalinmayor, I implemented what we discussed, ready to merge! 😊

Copy link
Copy Markdown
Contributor

@cmalinmayor cmalinmayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦖 🦷

@cmalinmayor cmalinmayor merged commit 135a5ad into main Apr 7, 2026
30 checks passed
@cmalinmayor cmalinmayor deleted the user-update-nodes-attrs-bulk branch April 7, 2026 18:39
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.

2 participants