Skip to content

Commit 3407724

Browse files
author
Daniel Gibson
committed
Tweak asset selection implementations to prefer looking at the asset_dep_graph rather than pulling individual asset nodes
Summary: This will improve performance in situations it is more efficicint to fetch the full set of asset keys BK (verify test coverage for these asset selections) > Insert changelog entry or delete this section.
1 parent 6c4955e commit 3407724

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

python_modules/dagster/dagster/_core/selector/subset_selector.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,12 @@ def fetch_sources(
237237
def has_upstream_within_selection(key: AssetKey) -> bool:
238238
if key not in dp:
239239
dp[key] = any(
240-
parent_node in within_selection or has_upstream_within_selection(parent_node)
241-
for parent_node in graph.get(key).parent_keys - {key}
240+
parent_key in within_selection or has_upstream_within_selection(parent_key)
241+
for parent_key in (graph.asset_dep_graph["upstream"][key] - {key})
242242
)
243243
return dp[key]
244244

245-
return {node for node in within_selection if not has_upstream_within_selection(node)}
245+
return {key for key in within_selection if not has_upstream_within_selection(key)}
246246

247247

248248
def fetch_connected_assets_definitions(

0 commit comments

Comments
 (0)