Skip to content

Commit 51b1320

Browse files
authored
add freshness policy assets and repository to toys (#29295)
## Summary & Motivation Add a dedicated repository and a few assets with internal freshness policies to toys ## How I Tested These Changes ## Changelog > Insert changelog entry or delete this section.
1 parent 7b24cc9 commit 51b1320

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from datetime import timedelta
2+
3+
import dagster as dg
4+
from dagster._core.definitions.freshness import InternalFreshnessPolicy
5+
6+
7+
@dg.asset(
8+
internal_freshness_policy=InternalFreshnessPolicy.time_window(fail_window=timedelta(minutes=60))
9+
)
10+
def asset_with_time_window_freshness_60m():
11+
return 1
12+
13+
14+
@dg.asset(
15+
internal_freshness_policy=InternalFreshnessPolicy.time_window(fail_window=timedelta(minutes=30))
16+
)
17+
def asset_with_time_window_freshness_30m():
18+
return 1
19+
20+
21+
@dg.asset(
22+
internal_freshness_policy=InternalFreshnessPolicy.time_window(
23+
fail_window=timedelta(minutes=15), warn_window=timedelta(minutes=10)
24+
)
25+
)
26+
def asset_with_time_window_freshness_and_warning():
27+
return 1
28+
29+
30+
def get_freshness_assets():
31+
return [
32+
asset_with_time_window_freshness_60m,
33+
asset_with_time_window_freshness_30m,
34+
asset_with_time_window_freshness_and_warning,
35+
]

Diff for: python_modules/dagster-test/dagster_test/toys/repo.py

+7
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,10 @@ def asset_health_repository():
234234
from dagster_test.toys.asset_health import get_assets_and_checks
235235

236236
return get_assets_and_checks()
237+
238+
239+
@repository
240+
def freshness_repository():
241+
from dagster_test.toys.freshness import get_freshness_assets
242+
243+
return get_freshness_assets()

0 commit comments

Comments
 (0)