diff --git a/brickflow/engine/task.py b/brickflow/engine/task.py index 8a299ffc..0e890f81 100644 --- a/brickflow/engine/task.py +++ b/brickflow/engine/task.py @@ -32,7 +32,7 @@ BrickflowProjectDeploymentSettings, get_brickflow_version, ) -from brickflow.bundles.model import JobsTasksNotebookTask, JobsTasksNotificationSettings +from brickflow.bundles.model import JobsTasksNotebookTask, JobsTasksNotificationSettings, JobsTasksHealthRules from brickflow.cli.projects import DEFAULT_BRICKFLOW_VERSION_MODE from brickflow.context import ( BrickflowBuiltInTaskVariables, @@ -479,6 +479,8 @@ class Task: task_settings: Optional[TaskSettings] = None custom_execute_callback: Optional[Callable] = None ensure_brickflow_plugins: bool = False + health: Optional[List[JobsTasksHealthRules]] = None + def __post_init__(self) -> None: self.is_valid_task_signature() diff --git a/docs/workflows.md b/docs/workflows.md index dc9921b2..77b94dcd 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -20,7 +20,8 @@ wf = Workflow( # (1)! email_notifications=EmailNotifications( on_start=["email@nike.com"], on_success=["email@nike.com"], - on_failure=["email@nike.com"] + on_failure=["email@nike.com"], + on_duration_warning_threshold_exceeded=["email@nike.com"] ), 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@nike.com"], on_success=["email@nike.com"], - on_failure=["email@nike.com"] + on_failure=["email@nike.com"], + on_duration_warning_threshold_exceeded=["email@nike.com"] ), timeout_seconds=timedelta(hours=2).seconds, max_retries=2, @@ -249,4 +257,5 @@ common_task_parameters={ "catalog": "development", "database": "your_database" } -``` \ No newline at end of file +``` +