Skip to content

Commit

Permalink
Don't iterate the whole asset graph to generate asset condition evalu…
Browse files Browse the repository at this point in the history
…ation records (#25809)

BK

## Summary & Motivation

## How I Tested These Changes

## Changelog

> Insert changelog entry or delete this section.
  • Loading branch information
gibsondan authored Nov 8, 2024
1 parent 58d3602 commit ad87c12
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from dagster import AssetKey
from dagster._core.scheduler.instigation import AutoMaterializeAssetEvaluationRecord

from dagster_graphql.implementation.fetch_assets import get_asset_nodes_by_asset_key
from dagster_graphql.schema.asset_condition_evaluations import (
GrapheneAssetConditionEvaluation,
GrapheneAssetConditionEvaluationRecord,
Expand Down Expand Up @@ -41,23 +40,9 @@ def _get_graphene_records_from_evaluations(
graphene_info: "ResolveInfo",
evaluation_records: Sequence[AutoMaterializeAssetEvaluationRecord],
) -> GrapheneAssetConditionEvaluationRecords:
asset_keys = {record.key for record in evaluation_records}

partitions_defs = {}

nodes = get_asset_nodes_by_asset_key(graphene_info)
for asset_key in asset_keys:
asset_node = nodes.get(asset_key)
partitions_defs[asset_key] = (
asset_node.asset_node_snap.partitions.get_partitions_definition()
if asset_node and asset_node.asset_node_snap.partitions
else None
)

return GrapheneAssetConditionEvaluationRecords(
records=[
GrapheneAssetConditionEvaluationRecord(evaluation, partitions_defs[evaluation.key])
for evaluation in evaluation_records
GrapheneAssetConditionEvaluationRecord(evaluation) for evaluation in evaluation_records
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
AutomationConditionEvaluation,
AutomationConditionSnapshot,
)
from dagster._core.definitions.partition import PartitionsDefinition
from dagster._core.scheduler.instigation import AutoMaterializeAssetEvaluationRecord

from dagster_graphql.implementation.events import iterate_metadata_entries
Expand Down Expand Up @@ -272,7 +271,6 @@ class Meta:
def __init__(
self,
record: AutoMaterializeAssetEvaluationRecord,
partitions_def: Optional[PartitionsDefinition],
):
evaluation_with_run_ids = record.get_evaluation_with_run_ids()
root_evaluation = evaluation_with_run_ids.evaluation
Expand Down

0 comments on commit ad87c12

Please sign in to comment.