Skip to content

add and remove methods on SerializableEntitySubset #29607

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

Open
wants to merge 1 commit into
base: jamie/update-state-for-reconciler
Choose a base branch
from

Conversation

jamiedemaria
Copy link
Contributor

@jamiedemaria jamiedemaria commented Apr 25, 2025

Summary & Motivation

allows adding and removing partition subsets/bools from SerializableEntitySubset

used in https://github.com/dagster-io/internal/pull/15287

How I Tested These Changes

Changelog

Insert changelog entry or delete this section.

Copy link
Contributor Author

jamiedemaria commented Apr 25, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

f"Cannot add {value} to subset. The types are incompatible. EntitySubset is not partitioned"
)

def add(self, value: EntitySubsetValue) -> "SerializableEntitySubset":
Copy link
Contributor Author

@jamiedemaria jamiedemaria Apr 25, 2025

Choose a reason for hiding this comment

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

this API feels a bit odd for non-partitioned assets when i use it. Maybe for non-partitioned assets you pass None instead of the boolean, but that strays from the conventions of the class.

Like this is just a bit awkward imo

new_subset = existing_subset.remove(True)
# does the same as
new_subset = existing_subset.remove(False)

@jamiedemaria jamiedemaria marked this pull request as ready for review April 25, 2025 19:05
@jamiedemaria jamiedemaria force-pushed the jamie/add-remove-methods-on-entity-subset branch from 4b6c3d7 to 8ef90a9 Compare April 25, 2025 21:35
@jamiedemaria jamiedemaria changed the base branch from master to jamie/update-state-for-reconciler April 25, 2025 21:35
Copy link
Contributor

@OwenKephart OwenKephart left a comment

Choose a reason for hiding this comment

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

I think we should add compute_union and compute_intersection methods here (which match the language of the EntitySubset class).

They'd take in another EntitySubset, so it'd be the caller's responsibility to construct that properly.

That would also clear up the weirdness you noted with the boolean case -- it's more obvious why intersecting two subsets with one of them being empty would always result in the same output vs. the current situation

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