Skip to content

Commit 820a75b

Browse files
committed
restore freshness state
1 parent cc9e6f0 commit 820a75b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

python_modules/dagster/dagster/_core/asset_graph_view/asset_graph_view.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from dagster._core.definitions.asset_key import AssetCheckKey, AssetKey, EntityKey, T_EntityKey
1919
from dagster._core.definitions.assets.graph.asset_graph_subset import AssetGraphSubset
2020
from dagster._core.definitions.events import AssetKeyPartitionKey
21+
from dagster._core.definitions.freshness import FreshnessState
2122
from dagster._core.definitions.partitions.context import (
2223
PartitionLoadingContext,
2324
use_partition_loading_context,
@@ -563,6 +564,26 @@ async def compute_subset_with_status(
563564
else:
564565
return self.get_empty_subset(key=key)
565566

567+
async def compute_subset_with_freshness_state(
568+
self, key: AssetKey, state: FreshnessState
569+
) -> EntitySubset[AssetKey]:
570+
from dagster._core.definitions.asset_health.asset_freshness_health import (
571+
AssetFreshnessHealthState,
572+
)
573+
574+
if not self.asset_graph.has(key) or self.asset_graph.get(key).freshness_policy is None:
575+
if state == FreshnessState.NOT_APPLICABLE:
576+
return self.get_full_subset(key=key)
577+
else:
578+
return self.get_empty_subset(key=key)
579+
580+
asset_freshness_health_state = await AssetFreshnessHealthState.compute_for_asset(key, self)
581+
582+
if asset_freshness_health_state.freshness_state == state:
583+
return self.get_full_subset(key=key)
584+
else:
585+
return self.get_empty_subset(key=key)
586+
566587
async def _compute_run_in_progress_check_subset(
567588
self, key: AssetCheckKey
568589
) -> EntitySubset[AssetCheckKey]:

0 commit comments

Comments
 (0)