forked from dagster-io/dagster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs] - Add retries to Asset docs (dagster-io#18515)
## Summary & Motivation This PR adds a section to the SDA concept page that demonstrates how to use `RetryPolicy` with the asset decorator. ## How I Tested These Changes Added a test; ran using Pytest
- Loading branch information
1 parent
ee69ede
commit b91bd70
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
examples/docs_snippets/docs_snippets/concepts/assets/asset_retry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from dagster import Backoff, Jitter, RetryPolicy, RetryRequested, asset | ||
|
||
|
||
@asset( | ||
retry_policy=RetryPolicy( | ||
max_retries=3, | ||
delay=0.2, # 200ms | ||
backoff=Backoff.EXPONENTIAL, | ||
jitter=Jitter.PLUS_MINUS, | ||
) | ||
) | ||
def retried_asset(): | ||
return "Retry me!" |
7 changes: 7 additions & 0 deletions
7
examples/docs_snippets/docs_snippets_tests/concepts_tests/assets_tests/test_asset_retry.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from dagster import materialize | ||
from docs_snippets.concepts.assets.asset_retry import retried_asset | ||
|
||
|
||
def test_retry_examples(): | ||
# just that it runs | ||
assert materialize([retried_asset]) |