Skip to content

Commit

Permalink
Rename the factory methods to DecoratorAssetsDefinitionBuilder. (#22400)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
schrockn authored Jun 12, 2024
1 parent 0d3750a commit 8a8a622
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -306,7 +306,7 @@ def from_args(
)

@staticmethod
def from_specs(
def from_multi_asset_specs(
*,
fn: Callable[..., Any],
op_name: str,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8a8a622

Please sign in to comment.