Skip to content

Commit

Permalink
Rename build_asset_outs to build_named_outs (#22382)
Browse files Browse the repository at this point in the history
## Summary & Motivation

Rename build_asset_outs to build_named_outs

## How I Tested These Changes

BK
  • Loading branch information
schrockn authored Jun 9, 2024
1 parent b0f0f9b commit 2f14546
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
from ..utils import DEFAULT_IO_MANAGER_KEY, DEFAULT_OUTPUT, NoValueSentinel, validate_tags_strict
from .decorator_assets_definition_builder import (
DecoratorAssetsDefinitionBuilderArgs,
build_asset_outs,
build_named_ins,
build_named_outs,
)


Expand Down Expand Up @@ -913,17 +913,17 @@ def inner(fn: Callable[..., Any]) -> AssetsDefinition:
keys_by_input_name = {
input_name: asset_key for asset_key, (input_name, _) in named_ins.items()
}
asset_outs = build_asset_outs(outs)
named_outs = build_named_outs(outs)

check_specs_by_output_name = validate_and_assign_output_names_to_check_specs(
check_specs, list(asset_outs.keys())
check_specs, list(named_outs.keys())
)
check_outs_by_output_name: Mapping[str, GraphOut] = {
output_name: GraphOut() for output_name in check_specs_by_output_name.keys()
}

combined_outs_by_output_name = {
**{output_name: GraphOut() for output_name, _ in asset_outs.values()},
**{output_name: GraphOut() for output_name, _ in named_outs.values()},
**check_outs_by_output_name,
}

Expand Down Expand Up @@ -979,7 +979,7 @@ def inner(fn: Callable[..., Any]) -> AssetsDefinition:
op_graph,
keys_by_input_name=keys_by_input_name,
keys_by_output_name={
output_name: asset_key for asset_key, (output_name, _) in asset_outs.items()
output_name: asset_key for asset_key, (output_name, _) in named_outs.items()
},
partitions_def=partitions_def,
partition_mappings=partition_mappings if partition_mappings else None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def build_named_ins(
return named_ins_by_asset_key


def build_asset_outs(asset_outs: Mapping[str, AssetOut]) -> Mapping[AssetKey, "NamedOut"]:
def build_named_outs(asset_outs: Mapping[str, AssetOut]) -> Mapping[AssetKey, "NamedOut"]:
"""Creates a mapping from AssetKey to (name of output, Out object)."""
named_outs_by_asset_key: Dict[AssetKey, NamedOut] = {}
for output_name, asset_out in asset_outs.items():
Expand Down Expand Up @@ -367,7 +367,7 @@ def from_asset_outs(
else set()
),
)
output_tuples_by_asset_key = build_asset_outs(asset_out_map)
named_outs_by_asset_key = build_named_outs(asset_out_map)

asset_deps = args.asset_deps

Expand All @@ -383,7 +383,7 @@ def from_asset_outs(
)

# validate that the asset_deps make sense
valid_asset_deps = asset_in_keys | set(output_tuples_by_asset_key.keys())
valid_asset_deps = asset_in_keys | set(named_outs_by_asset_key.keys())
for out_name, asset_keys in asset_deps.items():
if asset_out_map and out_name not in asset_out_map:
check.failed(
Expand All @@ -401,12 +401,12 @@ def from_asset_outs(
f" {list(valid_asset_deps)[:20]}",
)

keys_by_output_name = make_keys_by_output_name(output_tuples_by_asset_key)
keys_by_output_name = make_keys_by_output_name(named_outs_by_asset_key)
internal_deps = {keys_by_output_name[name]: asset_deps[name] for name in asset_deps}

return DecoratorAssetsDefinitionBuilder(
named_ins_by_asset_key=named_ins_by_asset_key,
named_outs_by_asset_key=output_tuples_by_asset_key,
named_outs_by_asset_key=named_outs_by_asset_key,
internal_deps=internal_deps,
op_name=op_name,
args=args,
Expand Down

0 comments on commit 2f14546

Please sign in to comment.