-
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
[external-assets] Change build_assets_job interface to use executable_assets
and loadable_assets
#19765
Conversation
19f636e
to
d38dd8d
Compare
046bc7f
to
46799c0
Compare
executable_assets
and loadable_assets
d38dd8d
to
b9050c4
Compare
46799c0
to
72f2a10
Compare
b9050c4
to
ba4542e
Compare
72f2a10
to
461f3a7
Compare
ba4542e
to
048a38d
Compare
f1f5c9e
to
3f2aba0
Compare
048a38d
to
a2f2c3d
Compare
a2f2c3d
to
ce80133
Compare
3f2aba0
to
b6156fe
Compare
ce80133
to
b83dc77
Compare
4e87476
to
15a91a8
Compare
b83dc77
to
0f4d3e1
Compare
d73afae
to
354ac39
Compare
13c86b0
to
9052bc8
Compare
1ae5a2c
to
03b5a31
Compare
9052bc8
to
fd7e3f9
Compare
03b5a31
to
c58fbba
Compare
fd7e3f9
to
40a9855
Compare
c58fbba
to
d3673a7
Compare
214c718
to
9d4a240
Compare
d3673a7
to
96bc75b
Compare
9d4a240
to
bc6baf2
Compare
96bc75b
to
30b2395
Compare
bc6baf2
to
d32e251
Compare
70c1932
to
1d3da61
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.
Great. Please heed final comment on invariants.
assets_by_partitions_def[observable.partitions_def] = [] | ||
if len(assets_by_partitions_def.keys()) == 0 or assets_by_partitions_def.keys() == {None}: | ||
for asset in executable_assets: | ||
executable_assets_by_partitions_def[asset.partitions_def].append(asset) |
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.
very odd that PartitionsDefinition
objects are hashable but this predates this PR
# sort to ensure some stability in the ordering | ||
all_partitions_defs = sorted( | ||
[p for p in executable_assets_by_partitions_def.keys() if p], key=repr |
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.
and indeed on the next line something odd as a result of it being hashable
executable_assets: Sequence[Union[AssetsDefinition, SourceAsset]], | ||
loadable_assets: Optional[Sequence[Union[SourceAsset, AssetsDefinition]]] = None, |
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.
much much better than older names
check.iterable_param(assets, "assets", of_type=(AssetsDefinition, SourceAsset)) | ||
source_assets = check.opt_sequence_param( | ||
source_assets, "source_assets", of_type=(SourceAsset, AssetsDefinition) | ||
check.iterable_param(executable_assets, "assets", of_type=(AssetsDefinition, SourceAsset)) |
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.
Let's also iterate through this and insure that all the source assets are observable as an invariant.
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.
Good idea, can actually just check is_executable
so that it flags unexecutable externals as well.
a3e7f79
to
72747d0
Compare
72747d0
to
ef13c4f
Compare
…e_assets` and `loadable_assets` (#19765) ## Summary & Motivation `build_assets_job` (an internal API) is the codepath through which all asset job construction flows. Currently, it accepts two lists of assets: - `assets: Sequence[AssetsDefinition]` - `source_assets: Sequence[Union[AssetsDefinition, SourceAsset]]` This is quite confusing. In particular, `source_assets` is poorly named. Not only does it contain `AssetsDefinition` (which gets internally converted to `SourceAsset` inside the function) but it also contains observable source assets that actually have nodes that will be executed. This PR changes `build_assets_job` to accept: - `executable_assets: Sequence[Union[AssetsDefinition, SourceAsset]]` - `loadable_assets: Sequence[Union[AssetsDefinition, SourceAsset]]` This makes the purpose of these two assets arrays more clear. It can be considered an incremental step in the source asset -> external asset refactor. The PR leaves the internal logic of `build_assets_job` unchanged (though it will be changed upstack), passing separate collections of `AssetsDefinition` and `SourceAsset` further into the system per the status quo. ## How I Tested These Changes Existing test suite. A few GQL snapshots are updated due to minor changes in the asset base jobs in the GQL repo. Specifically, the unexecutable external asset is now no longer included in any of the base jobs where previously it was included in all of them (as all unpartitioned assets defs were). This is not a function of change to the `build_assets_job` logic but rather to the base job construction routine (which is one of the two `build_assets_job` callsites).
Summary & Motivation
build_assets_job
(an internal API) is the codepath through which all asset job construction flows. Currently, it accepts two lists of assets:assets: Sequence[AssetsDefinition]
source_assets: Sequence[Union[AssetsDefinition, SourceAsset]]
This is quite confusing. In particular,
source_assets
is poorly named. Not only does it containAssetsDefinition
(which gets internally converted toSourceAsset
inside the function) but it also contains observable source assets that actually have nodes that will be executed.This PR changes
build_assets_job
to accept:executable_assets: Sequence[Union[AssetsDefinition, SourceAsset]]
loadable_assets: Sequence[Union[AssetsDefinition, SourceAsset]]
This makes the purpose of these two assets arrays more clear. It can be considered an incremental step in the source asset -> external asset refactor.
The PR leaves the internal logic of
build_assets_job
unchanged (though it will be changed upstack), passing separate collections ofAssetsDefinition
andSourceAsset
further into the system per the status quo.How I Tested These Changes
Existing test suite.
A few GQL snapshots are updated due to minor changes in the asset base jobs in the GQL repo. Specifically, the unexecutable external asset is now no longer included in any of the base jobs where previously it was included in all of them (as all unpartitioned assets defs were). This is not a function of change to the
build_assets_job
logic but rather to the base job construction routine (which is one of the twobuild_assets_job
callsites).