Skip to content

Notifying GraphArrayView of updates#267

Open
yfukai wants to merge 8 commits intoroyerlab:mainfrom
yfukai:gav_notified2
Open

Notifying GraphArrayView of updates#267
yfukai wants to merge 8 commits intoroyerlab:mainfrom
yfukai:gav_notified2

Conversation

@yfukai
Copy link
Contributor

@yfukai yfukai commented Feb 19, 2026

Assumes #266 is merged.
Another attempt to solve #202.

@yfukai yfukai changed the title added update_node signal and connected them to spatial filters Notifying GraphArrayView of updates Feb 19, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 67.02128% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.47%. Comparing base (e4bb183) to head (82cf59a).

Files with missing lines Patch % Lines
src/tracksdata/array/_graph_array.py 64.00% 11 Missing and 7 partials ⚠️
src/tracksdata/array/_nd_chunk_cache.py 60.60% 7 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #267      +/-   ##
==========================================
- Coverage   87.92%   87.47%   -0.45%     
==========================================
  Files          56       56              
  Lines        4471     4560      +89     
  Branches      789      808      +19     
==========================================
+ Hits         3931     3989      +58     
- Misses        344      362      +18     
- Partials      196      209      +13     

☔ 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.

@yfukai yfukai marked this pull request as ready for review February 19, 2026 13:46
@yfukai yfukai mentioned this pull request Feb 19, 2026
8 tasks
@JoOkuma
Copy link
Member

JoOkuma commented Feb 27, 2026

@yfukai, could you merge with main and resolve the conflicts?

@yfukai
Copy link
Contributor Author

yfukai commented Feb 27, 2026

Done!

Copy link
Member

@JoOkuma JoOkuma left a comment

Choose a reason for hiding this comment

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

@yfukai, thanks for the PR.
I left a few minor comments.

raise ValueError(f"Node {node_id} does not exist in the graph.")

local_node_id = self._map_to_local(node_id)
old_attrs = dict(self._graph[local_node_id])
Copy link
Member

Choose a reason for hiding this comment

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

Would this work?

Suggested change
old_attrs = dict(self._graph[local_node_id])
old_attrs = self._graph[local_node_id]

Comment on lines +1836 to +1838
new_attrs_by_id = {
row[DEFAULT_ATTR_KEYS.NODE_ID]: {key: row[key] for key in attr_keys} for row in new_df.rows(named=True)
}
Copy link
Member

Choose a reason for hiding this comment

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

Would this work? row already contains only nod_id and *attr_keys from the line above.

Suggested change
new_attrs_by_id = {
row[DEFAULT_ATTR_KEYS.NODE_ID]: {key: row[key] for key in attr_keys} for row in new_df.rows(named=True)
}
new_attrs_by_id = {
row.pop(DEFAULT_ATTR_KEYS.NODE_ID): row for row in new_df.rows(named=True)
}

Comment on lines +1836 to +1838
new_attrs_by_id = {
row[DEFAULT_ATTR_KEYS.NODE_ID]: {key: row[key] for key in attr_keys} for row in new_df.rows(named=True)
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
new_attrs_by_id = {
row[DEFAULT_ATTR_KEYS.NODE_ID]: {key: row[key] for key in attr_keys} for row in new_df.rows(named=True)
}
new_attrs_by_id = new_df.rows_by_key(key=DEFAULT_ATTR_KEYS.NODE_ID, named=True, unique=True)

It seems polars has a function for this, rows_by_key
This would be the preferred usage, in my opinion.

I think I have this pattern in our codebase. I'll check later if they can all be refactored to use this.

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.

3 participants