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

Move spec resolution into mapper #22229

Merged
merged 1 commit into from
Jun 6, 2024
Merged

Conversation

schrockn
Copy link
Member

@schrockn schrockn commented Jun 2, 2024

Summary & Motivation

We convert back and forth from non-spec code paths and then reconstruct the specs that would have been used to construct the multi_asset, which is a bit strange.

This moves that logic into the factory machinery.

How I Tested These Changes

BK

@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from fee4662 to ce4b8b3 Compare June 2, 2024 20:46
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from 8f2118d to 3ea6693 Compare June 2, 2024 20:46
@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from ce4b8b3 to 58ccf54 Compare June 2, 2024 20:53
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from 3ea6693 to 82d128a Compare June 2, 2024 20:53
@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from 58ccf54 to d045300 Compare June 2, 2024 21:18
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from 82d128a to a5874c1 Compare June 2, 2024 21:18
@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from d045300 to f040755 Compare June 2, 2024 21:36
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from a5874c1 to 84bc9a8 Compare June 2, 2024 21:36
@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from f040755 to 9a30fe6 Compare June 2, 2024 21:43
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from 84bc9a8 to 4a40d8f Compare June 2, 2024 21:44
@schrockn schrockn force-pushed the aget-multi-asset-refactor-7 branch from 9a30fe6 to 765f08f Compare June 3, 2024 10:50
@schrockn schrockn force-pushed the aget-multi-asset-refactor-8 branch from 377407b to 8376f62 Compare June 3, 2024 10:50
Comment on lines +357 to +360
def _spec_resolver(in_out_mapper: "InOutMapper") -> Sequence[AssetSpec]:
resolved_specs = []
input_deps_by_key = {
key: AssetDep(
asset=key, partition_mapping=in_out_mapper.partition_mappings.get(key)
)
for key in in_out_mapper.asset_keys_by_input_names.values()
}
input_deps = list(input_deps_by_key.values())
for output_name, asset_out in asset_out_map.items():
key = in_out_mapper.asset_keys_by_output_name[output_name]
if asset_deps:
deps = [
input_deps_by_key.get(
dep_key,
AssetDep(
asset=dep_key,
partition_mapping=in_out_mapper.partition_mappings.get(key),
),
)
for dep_key in asset_deps.get(output_name, [])
]
else:
deps = input_deps

resolved_specs.append(asset_out.to_spec(key, deps=deps))
return resolved_specs
Copy link
Member Author

Choose a reason for hiding this comment

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

We move this strange-ish callback into a more standard up the stack.

@schrockn schrockn requested review from smackesey and sryza June 3, 2024 10:58
@schrockn schrockn marked this pull request as ready for review June 3, 2024 10:59
This was referenced Jun 8, 2024
salazarm pushed a commit that referenced this pull request Jun 10, 2024
## Summary & Motivation

We convert back and forth from non-spec code paths and then reconstruct the specs that *would* have been used to construct the `multi_asset`, which is a bit strange.

This moves that logic into the factory machinery.

## How I Tested These Changes

BK
danielgafni pushed a commit to danielgafni/dagster that referenced this pull request Jun 18, 2024
## Summary & Motivation

We convert back and forth from non-spec code paths and then reconstruct the specs that *would* have been used to construct the `multi_asset`, which is a bit strange.

This moves that logic into the factory machinery.

## How I Tested These Changes

BK
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