-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
partition methods on AssetExecutionContext #16625
partition methods on AssetExecutionContext #16625
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
"""TODO - implement in stacked pr.""" | ||
pass | ||
def partition_key_range_for_asset_key( | ||
self, asset_key: CoercibleToAssetKey, is_dependency: bool = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not super happy with the is_dependency
solution to the self dependent asset problem. here's my comment from the first PR exploring this:
the is_dependency bool param here is to handle the self-dependent partition case. Basically when you have a self-dependent partition, if you said context.partition_key_for_asset_key("my_asset")
it's unclear if you want the partition key of my_asset as a dependency, or as is being currently materialized. I'm handling this (for now at least) by allowing users to specify is_dependency
to indicate they want it loaded as a dependency.
In all other cases, the function should be able to figure out the correct partition key to load given the current asset
I'm not set on this solution, so if you have any concerns or other ideas let me know
def partition_key_range_for_asset_key(self, asset_key: AssetKey) -> PartitionKeyRange: | ||
"""TODO - implement in stacked pr.""" | ||
pass | ||
def partition_key_range_for_asset_key( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also like to have a discussion of what partition methods should be on the AssetExecutionContext. Currently we have:
partition_key
propertypartition_key_range
propertypartition_time_window
propertypartition_key_range_for_asset_key
method
This leaves out the ability to:
- Directly get a TimeWindow for a partition of an upstream asset, or any asset in a multi asset, bc there's no
partition_time_window_for_asset_key
method. The user can construct this info from the key range and the partitions def, so we may just need to document this process. It is pretty convoluted though, so we may be better off adding a key_range -> time_window helper method to the partition definitions - Directly get a list of all partition keys being materialized for a static partitioned asset. The user can construct this info by using key range and the partitions def, so we may just need to document this process
- Get the PartitionsDefinition for an asset from the context. This seems pretty important to add, especially if we want the users to use the PartitionsDefinition to get time windows/key lists/etc
I just want to make sure this is the direction we want to go. We can always add more methods in at a later date, but if we decide we need them now, i'll go ahead and add them in
959a490
to
2c77877
Compare
752cc2d
to
3809c63
Compare
2c77877
to
1ac4f61
Compare
3809c63
to
46797ee
Compare
1ac4f61
to
8b3c446
Compare
eb2c490
to
79cb608
Compare
c92fea1
to
e665260
Compare
9d2c497
to
92457f9
Compare
9355c3e
to
34377b4
Compare
Discussing and aligning on partition method APIs here https://github.com/dagster-io/internal/discussions/6704. then will implement in this PR |
efa6880
to
0788e4e
Compare
27152b9
to
d01d5d2
Compare
305e87d
to
c8e9c94
Compare
c8e9c94
to
737c656
Compare
1448509
to
5ba005b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the overlap with this and #16480?
back to your queue
closing for now. I think determining the partition method APIs will be best done in a discussion. |
Summary & Motivation
Adds
partition_key_range_for_asset_key
toAssetExecutionContext
. Also does some minor reorganizing of partition methods onStepExecutionContext
to support passing AssetKeys rather than input namesTo Do:
partition_keys_for_asset_key
method to support materializing multiple static partitionsHow I Tested These Changes