Skip to content
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

[module-loaders] Genericize object list utils #26535

Conversation

dpeng817
Copy link
Contributor

@dpeng817 dpeng817 commented Dec 17, 2024

Summary & Motivation

The object list utils were previously defining behavior mostly in terms of assets. Genericize the utilities to instead refer to "DagsterObjects" where appropriate; in preparation for handling other types of dagster definitions.

How I Tested These Changes

Existing tests

Copy link
Contributor Author

dpeng817 commented Dec 17, 2024

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.

@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from 7ec766f to f2e7f3d Compare December 17, 2024 17:54
@dpeng817 dpeng817 force-pushed the dpeng817/key_iterator_removal branch from 8831b0b to db2f79a Compare December 18, 2024 02:52
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from f2e7f3d to a67444d Compare December 18, 2024 02:52
@dpeng817 dpeng817 force-pushed the dpeng817/key_iterator_removal branch from db2f79a to 091517b Compare December 18, 2024 03:35
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from a67444d to fa8dff1 Compare December 18, 2024 03:35
@dpeng817 dpeng817 marked this pull request as ready for review December 18, 2024 15:23
@dpeng817 dpeng817 changed the title Genericize object list utils [module-loaders] Genericize object list utils Dec 18, 2024
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 like the direction, just think we should update the names

@@ -9,8 +9,11 @@
from dagster._core.definitions.cacheable_assets import CacheableAssetsDefinition
from dagster._core.definitions.source_asset import SourceAsset

LoadableAssetTypes = Union[AssetsDefinition, AssetSpec, SourceAsset, CacheableAssetsDefinition]
KeyScopedAssetObjects = (AssetsDefinition, AssetSpec, SourceAsset)
LoadableAssetObject = Union[AssetsDefinition, AssetSpec, SourceAsset, CacheableAssetsDefinition]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Object -> Def in all of these names would make more sense

@@ -46,17 +47,17 @@ def from_modules(cls, modules: Iterable[ModuleType]) -> "LoadedAssetsList":
)

@cached_property
def flat_object_list(self) -> Sequence[LoadableAssetTypes]:
def flat_object_list(self) -> Sequence[LoadableDagsterObject]:
Copy link
Contributor

Choose a reason for hiding this comment

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

e.g.

def dlat_defs_list(self) -> Sequence[LoadableDagsterDef]:

@dpeng817 dpeng817 force-pushed the dpeng817/key_iterator_removal branch from 091517b to 49c6d6b Compare December 18, 2024 18:02
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from fa8dff1 to d8e8a8f Compare December 18, 2024 18:03
@dpeng817 dpeng817 force-pushed the dpeng817/key_iterator_removal branch from 49c6d6b to 51512e6 Compare December 18, 2024 20:24
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from d8e8a8f to 01f281a Compare December 18, 2024 20:24
@dpeng817 dpeng817 force-pushed the dpeng817/key_iterator_removal branch from 51512e6 to 3553a63 Compare December 18, 2024 20:50
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from 01f281a to f7eb224 Compare December 18, 2024 20:51
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from f1016a1 to 2b7cdbb Compare December 19, 2024 01:19
@dpeng817 dpeng817 changed the base branch from dpeng817/key_iterator_removal to dpeng817/split_load_file December 19, 2024 01:19
Copy link
Contributor Author

@dpeng817 dpeng817 left a comment

Choose a reason for hiding this comment

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

@OwenKephart so I'd like to push back for the asset case; it's very hard to reason about assets since there is AssetsDefinition, SourceAsset and AssetSpec, and those can all have the same values. I think that that SourceAsset and AssetSpec falling into a defs_list is a bit strange, but maybe that's saying more about the naming of those APIs than anything else.

I don't feel that strongly about it but I'd request that if you really want the name change that we do it in a follow up; turns into an absolutely nightmarish rebase (changes like every line of the object_list.py file)

@dpeng817 dpeng817 dismissed OwenKephart’s stale review December 19, 2024 01:46

back to queue for discussion

@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from 9e56100 to 143aa7b Compare December 19, 2024 02:05
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from 2b7cdbb to d2db161 Compare December 19, 2024 02:06
Copy link
Contributor

yuhan commented Dec 19, 2024

I do like Def better than Object simply because Object would be new noun.

But this isn't extremely publicly facing and we are in a release freeze zone, so I think landing + follow up for name changes is reasonable. (you have my verbal stamp. i will let owen approve in case of any strong reason not to)

Copy link
Contributor Author

I'm fine with making the change in a follow up

@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from 143aa7b to 67ee4a3 Compare December 19, 2024 14:19
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from d2db161 to 6bc53ed Compare December 19, 2024 14:19
@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from 67ee4a3 to 370277b Compare December 19, 2024 14:24
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from 6bc53ed to a1e7c18 Compare December 19, 2024 14:24
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.

Requesting changes in re: the naming change discussion in the PR above.

If we're aligned on those changes, happy to approve this PR and let you do the refactor stacked on top or wherever's convenient

@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from 370277b to 349e3bd Compare December 19, 2024 15:54
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from a1e7c18 to e9d0bba Compare December 19, 2024 15:54
@dpeng817
Copy link
Contributor Author

We're aligned @OwenKephart - I'll make the naming changes in a followup

@dpeng817 dpeng817 requested a review from OwenKephart December 19, 2024 16:10
@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from 349e3bd to a10d824 Compare December 19, 2024 16:36
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from e9d0bba to b1f2469 Compare December 19, 2024 16:36
@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from a10d824 to b5065bf Compare December 19, 2024 16:40
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from b1f2469 to d4430a7 Compare December 19, 2024 16:40
@dpeng817 dpeng817 force-pushed the dpeng817/split_load_file branch from b5065bf to 41ec0ab Compare December 19, 2024 16:41
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from d4430a7 to 3f706f1 Compare December 19, 2024 16:41
Base automatically changed from dpeng817/split_load_file to dpeng817/delete_extra_source_assets December 19, 2024 16:52
@dpeng817 dpeng817 force-pushed the dpeng817/genericize_typehints_and_methods branch from 3f706f1 to 73810c7 Compare December 19, 2024 16:53
@dpeng817 dpeng817 merged commit 0405939 into dpeng817/delete_extra_source_assets Dec 19, 2024
1 check was pending
@dpeng817 dpeng817 deleted the dpeng817/genericize_typehints_and_methods branch December 19, 2024 16:54
dpeng817 added a commit that referenced this pull request Dec 19, 2024
## Summary & Motivation
The object list utils were previously defining behavior mostly in terms
of assets. Genericize the utilities to instead refer to "DagsterObjects"
where appropriate; in preparation for handling other types of dagster
definitions.

## How I Tested These Changes
Existing tests
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