From 8a8a622fa6d7162f2f7a3dea8c1f0987570744f1 Mon Sep 17 00:00:00 2001 From: Nick Schrock Date: Wed, 12 Jun 2024 07:21:42 -0700 Subject: [PATCH] Rename the factory methods to DecoratorAssetsDefinitionBuilder. (#22400) ## Summary & Motivation I thought these methods would more natural, but there is decorator-specific logic that will live on for awhile, so just being explicit about it. Once in these methods then we can work on unifying the logic, but moving the asset check stuff to use these existing factory methods is just changing too much at the same time. ## How I Tested These Changes BK --- .../_core/definitions/decorators/asset_decorator.py | 4 ++-- .../decorators/decorator_assets_definition_builder.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py b/python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py index b3e173b81ea92..7fab01d738bb9 100644 --- a/python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py +++ b/python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py @@ -449,7 +449,7 @@ def create_assets_def_from_fn_and_decorator_args( decorator_name="@asset", ) - builder = DecoratorAssetsDefinitionBuilder.from_asset_outs( + builder = DecoratorAssetsDefinitionBuilder.from_asset_outs_in_asset_centric_decorator( fn=fn, op_name=out_asset_key.to_python_identifier(), asset_in_map=builder_args.asset_in_map, @@ -616,7 +616,7 @@ def my_function(asset0): ) def inner(fn: Callable[..., Any]) -> AssetsDefinition: - builder = DecoratorAssetsDefinitionBuilder.from_args(args=args, fn=fn) + builder = DecoratorAssetsDefinitionBuilder.for_multi_asset(args=args, fn=fn) check.invariant( len(builder.overlapping_output_names) == 0, diff --git a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py index 4eba3e75ad3a3..77a153955da9c 100644 --- a/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py +++ b/python_modules/dagster/dagster/_core/definitions/decorators/decorator_assets_definition_builder.py @@ -264,7 +264,7 @@ def __init__( ) @staticmethod - def from_args( + def for_multi_asset( *, fn: Callable[..., Any], args: DecoratorAssetsDefinitionBuilderArgs ) -> "DecoratorAssetsDefinitionBuilder": op_name = args.name or fn.__name__ @@ -286,7 +286,7 @@ def from_args( "Can not pass internal_asset_deps and specs to @multi_asset, specify deps on" " the AssetSpecs directly." ) - return DecoratorAssetsDefinitionBuilder.from_specs( + return DecoratorAssetsDefinitionBuilder.from_multi_asset_specs( fn=fn, op_name=op_name, passed_args=args, @@ -295,7 +295,7 @@ def from_args( asset_in_map=args.asset_in_map, ) - return DecoratorAssetsDefinitionBuilder.from_asset_outs( + return DecoratorAssetsDefinitionBuilder.from_asset_outs_in_asset_centric_decorator( fn=fn, op_name=op_name, asset_in_map=args.asset_in_map, @@ -306,7 +306,7 @@ def from_args( ) @staticmethod - def from_specs( + def from_multi_asset_specs( *, fn: Callable[..., Any], op_name: str, @@ -367,7 +367,7 @@ def from_specs( ) @staticmethod - def from_asset_outs( + def from_asset_outs_in_asset_centric_decorator( *, fn: Callable[..., Any], op_name: str,