-
Notifications
You must be signed in to change notification settings - Fork 235
Add scheduling docs for Airflow 3 #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8cc616c
Purpose scheduling changes for DAG-Facotry 1.0
pankajastro ed401a9
Purpose sheduling chnages for DAG-Facotry 1.0
pankajastro 39c7a65
Purpose sheduling chnages for DAG-Facotry 1.0
pankajastro 5f5b701
Address review feedback
pankajastro 2d9b0ea
Address review feedback
pankajastro 9dbfb8c
Add release version
pankajastro 200b6e3
Address feedback
pankajastro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,92 @@ | ||
| # Scheduling | ||
|
|
||
| - *Released in version: 0.23.0* | ||
|
|
||
| DAG-Factory offers flexible scheduling options so your DAGs can run on time or based on data availability. Whether you're triggering DAGs on a cron schedule, a time delta, or when an upstream asset is ready, you can configure it easily using the schedule field in your YAML. | ||
|
|
||
| Below are the supported scheduling types, each with consistent structure and examples to help you get started. | ||
|
|
||
| ## How to Use | ||
|
|
||
| - Every schedule block must specify a type, such as `cron`, `timedelta`, `relativedelta`, `timetable`, or `assets`. | ||
| - The actual configuration goes under the value key. | ||
| - Only one schedule type should be defined per DAG. | ||
|
|
||
| ## Example Overview | ||
|
|
||
| | Type | Description | Use Case Example | | ||
| |-----------------|---------------------------------------|-------------------------------------| | ||
| | `cron` | Run based on a cron string | Every day at midnight | | ||
| | `timedelta` | Fixed intervals between runs | Every 6 hours | | ||
| | `relativedelta` | Calendar-aware schedule (e.g. months) | Every 1st of the month | | ||
| | `timetable` | Advanced Airflow timetables | Custom trigger logic | | ||
| | `assets` | Trigger based on asset readiness | When data `X` and `Y` are available | | ||
|
pankajastro marked this conversation as resolved.
|
||
| | `datasets` | Trigger based on datasets readiness | When data `X` and `Y` are available | | ||
|
|
||
| ## Schema Options | ||
|
|
||
| ### 1. Cron-Based Schedule | ||
|
|
||
| ```yaml title="Corn Schedule" | ||
| --8<-- "tests/schedule/cron.yml" | ||
| ``` | ||
|
|
||
| Or, | ||
|
|
||
| ```yaml title="Corn Schedule" | ||
| --8<-- "tests/schedule/cron_dict.yml" | ||
| ``` | ||
|
|
||
| ### 2. Timedelta Schedule | ||
|
|
||
| ```yaml title="Timedelta Schedule" | ||
| --8<-- "tests/schedule/timedelta.yml" | ||
| ``` | ||
|
|
||
| ### 3. RelativeDelta Schedule | ||
|
|
||
| ```yaml title="Relativedelta Schedule" | ||
| --8<-- "tests/schedule/relativedelta.yml" | ||
| ``` | ||
|
|
||
| ## 4. Timetable (Advanced Scheduling) | ||
|
|
||
| ```yaml title="Timetable Schedule" | ||
| --8<-- "tests/schedule/timetable.yml" | ||
| ``` | ||
|
|
||
| ### 5. Asset-Based Triggering | ||
|
|
||
| #### OR (default when list is provided) | ||
|
|
||
| ```yaml title="OR Condition" | ||
| --8<-- "tests/schedule/list_asset.yml" | ||
| ``` | ||
|
|
||
| ```yaml title="OR Condition" | ||
| --8<-- "tests/schedule/or_asset.yml" | ||
| ``` | ||
|
|
||
| #### AND (explicit composition) | ||
|
|
||
| ```yaml title="AND Condition" | ||
| --8<-- "tests/schedule/and_asset.yml" | ||
| ``` | ||
|
|
||
| #### Nested And Or Condition | ||
|
|
||
| ```yaml title="Nested AND OR Condition" | ||
| --8<-- "tests/schedule/nested_asset.yml" | ||
| ``` | ||
|
|
||
| #### With Watchers | ||
|
|
||
| ```yaml title="Assert with watcher" | ||
| --8<-- "tests/schedule/asset_with_watcher.yml" | ||
| ``` | ||
|
pankajastro marked this conversation as resolved.
|
||
|
|
||
| ### 6. Datasets-Based Triggering | ||
|
|
||
| ```yaml | ||
| schedule: [ 's3://bucket_example/raw/dataset1.json', 's3://bucket_example/raw/dataset2.json' ] | ||
| ``` | ||
This file contains hidden or 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 hidden or 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,10 @@ | ||
| schedule: | ||
| type: assets | ||
| value: | ||
| and: | ||
| - uri: s3://dag1/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| - uri: s3://dag2/output_1.txt | ||
| extra: | ||
| hi: bye |
This file contains hidden or 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 @@ | ||
| schedule: | ||
| type: asset | ||
| value: | ||
| - uri: s3://dag1/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| watchers: | ||
| - callable: airflow.sdk.AssetWatcher | ||
| name: test_asset_watcher | ||
| trigger: | ||
| callable: airflow.providers.standard.triggers.file.FileDeleteTrigger | ||
| params: | ||
| filepath: "/temp/file.txt" |
This file contains hidden or 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 @@ | ||
| schedule: '@daily' |
This file contains hidden or 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,3 @@ | ||
| schedule: | ||
| type: cron | ||
| value: "0 0 * * *" |
This file contains hidden or 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,9 @@ | ||
| schedule: | ||
| type: assets | ||
| value: | ||
| - uri: s3://dag1/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| - uri: s3://dag2/output_1.txt | ||
| extra: | ||
| hi: bye |
This file contains hidden or 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,14 @@ | ||
| schedule: | ||
| type: assets | ||
| value: | ||
| or: | ||
| - and: | ||
| - uri: s3://dag1/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| - uri: s3://dag2/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| - uri: s3://dag3/output_3.txt | ||
| extra: | ||
| hi: bye |
This file contains hidden or 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,10 @@ | ||
| schedule: | ||
| type: assets | ||
| value: | ||
| or: | ||
| - uri: s3://dag1/output_1.txt | ||
| extra: | ||
| hi: bye | ||
| - uri: s3://dag2/output_1.txt | ||
| extra: | ||
| hi: bye |
This file contains hidden or 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,4 @@ | ||
| schedule: | ||
| type: relativedelta | ||
| value: | ||
| month: 1 |
This file contains hidden or 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,4 @@ | ||
| schedule: | ||
| type: timedelta | ||
| value: | ||
| seconds: 30 |
This file contains hidden or 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 @@ | ||
| schedule: | ||
| type: timetable | ||
| value: | ||
| callable: airflow.timetables.trigger.CronTriggerTimetable | ||
| params: | ||
| cron: "* * * * *" | ||
| timezone: UTC |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.