-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to set timeout health check in workflows (#58)
* Add ability to set timeout health check in workflows --------- Co-authored-by: Brent Johnson <[email protected]>
- Loading branch information
1 parent
b2af63d
commit ae84716
Showing
12 changed files
with
65 additions
and
4 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,8 @@ wf = Workflow( # (1)! | |
email_notifications=EmailNotifications( | ||
on_start=["[email protected]"], | ||
on_success=["[email protected]"], | ||
on_failure=["[email protected]"] | ||
on_failure=["[email protected]"], | ||
on_duration_warning_threshold_exceeded=["[email protected]"] | ||
), | ||
timeout_seconds=timedelta(hours=2).seconds | ||
), | ||
|
@@ -44,6 +45,11 @@ wf = Workflow( # (1)! | |
"catalog": "development", | ||
"database": "your_database" | ||
}, | ||
health = { # (16)! | ||
"metric": "RUN_DURATION_SECONDS", | ||
"op": "GREATER_THAN", | ||
"value": 7200 | ||
} | ||
) | ||
|
||
|
||
|
@@ -67,6 +73,7 @@ def task_function(*, test="var"): | |
13. Define the common task parameters that can be used in all the tasks | ||
14. Define a workflow task and associate it to the workflow | ||
15. Define the schedule pause status. It is defaulted to "UNPAUSED" | ||
16. Define health check condition that triggers duration warning threshold exceeded notifications | ||
|
||
### Clusters | ||
|
||
|
@@ -207,7 +214,8 @@ default_task_settings=TaskSettings( | |
email_notifications=EmailNotifications( | ||
on_start=["[email protected]"], | ||
on_success=["[email protected]"], | ||
on_failure=["[email protected]"] | ||
on_failure=["[email protected]"], | ||
on_duration_warning_threshold_exceeded=["[email protected]"] | ||
), | ||
timeout_seconds=timedelta(hours=2).seconds, | ||
max_retries=2, | ||
|
@@ -249,4 +257,5 @@ common_task_parameters={ | |
"catalog": "development", | ||
"database": "your_database" | ||
} | ||
``` | ||
``` | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,11 @@ | |
run_as_user="[email protected]", | ||
tags={"test": "test2"}, | ||
common_task_parameters={"all_tasks1": "test", "all_tasks3": "123"}, # type: ignore | ||
health={ | ||
"rules": [ | ||
{"metric": "RUN_DURATION_SECONDS", "op": "GREATER_THAN", "value": 7200.0} | ||
] | ||
}, | ||
) | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,6 +182,13 @@ def test_tags(self): | |
def test_default_task_settings(self): | ||
assert wf.default_task_settings is not None | ||
|
||
def test_health_settings(self): | ||
assert wf.health == { | ||
"rules": [ | ||
{"metric": "RUN_DURATION_SECONDS", "op": "GREATER_THAN", "value": 7200} | ||
] | ||
} | ||
|
||
def test_user(self): | ||
principal = "[email protected]" | ||
u = User(principal) | ||
|