Skip to content

Commit

Permalink
add task and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Johnson committed Nov 3, 2023
1 parent 8d850ce commit 131625e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion brickflow/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down
15 changes: 12 additions & 3 deletions docs/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
),
Expand All @@ -44,6 +45,11 @@ wf = Workflow( # (1)!
"catalog": "development",
"database": "your_database"
},
health = { # (16)!
"metric": "RUN_DURATION_SECONDS",
"op": "GREATER_THAN",
"value": 7200
}
)


Expand All @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -249,4 +257,5 @@ common_task_parameters={
"catalog": "development",
"database": "your_database"
}
```
```

0 comments on commit 131625e

Please sign in to comment.