Skip to content

Commit

Permalink
fix unit tests and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Johnson committed Nov 7, 2023
1 parent 131625e commit 44e4e9e
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 16 deletions.
7 changes: 5 additions & 2 deletions brickflow/engine/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
BrickflowProjectDeploymentSettings,
get_brickflow_version,
)
from brickflow.bundles.model import JobsTasksNotebookTask, JobsTasksNotificationSettings, JobsTasksHealthRules
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 @@ -480,7 +484,6 @@ class Task:
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
3 changes: 2 additions & 1 deletion brickflow/engine/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
JobsWebhookNotifications,
JobsNotificationSettings,
JobsTrigger,
JobsHealthRules
JobsHealthRules,
)
from brickflow.context import BrickflowInternalVariables
from brickflow.engine import ROOT_NODE
Expand Down Expand Up @@ -117,6 +117,7 @@ class Workflow:
schedule_pause_status: str = "UNPAUSED"
default_cluster: Optional[Cluster] = None
clusters: List[Cluster] = field(default_factory=lambda: [])

health: Optional[List[JobsHealthRules]] = None
default_task_settings: TaskSettings = TaskSettings()
email_notifications: Optional[WorkflowEmailNotifications] = None
Expand Down
1 change: 1 addition & 0 deletions tests/codegen/expected_bundles/dev_bundle_monorepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environments:
email_notifications: null
notification_settings: null
webhook_notifications: null
health: null
git_source:
git_commit: a
git_provider: github
Expand Down
1 change: 1 addition & 0 deletions tests/codegen/expected_bundles/dev_bundle_polyrepo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environments:
email_notifications: null
notification_settings: null
webhook_notifications: null
health: null
git_source:
git_commit: a
git_provider: github
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ environments:
jobs:
some_wf:
email_notifications: null
health: null
git_source:
git_commit: a
git_provider: github
Expand Down Expand Up @@ -64,6 +65,7 @@ environments:
email_notifications: null
notification_settings: null
webhook_notifications: null
health: null
git_source:
git_commit: a
git_provider: github
Expand Down
1 change: 1 addition & 0 deletions tests/codegen/expected_bundles/local_bundle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environments:
email_notifications: null
notification_settings: null
webhook_notifications: null
health: null
git_source: null
job_clusters: []
max_concurrent_runs: 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ environments:
email_notifications: null
notification_settings: null
webhook_notifications: null
health: null
git_source: null
job_clusters: []
max_concurrent_runs: 1.0
Expand Down
10 changes: 3 additions & 7 deletions tests/engine/sample_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@
),
tags={"test": "test2"},
common_task_parameters={"all_tasks1": "test", "all_tasks3": "123"}, # type: ignore
health = {
health={
"rules": [
{
"metric": "RUN_DURATION_SECONDS",
"op": "GREATER_THAN",
"value": 7200
}
{"metric": "RUN_DURATION_SECONDS", "op": "GREATER_THAN", "value": 7200}
]
}
},
)


Expand Down
9 changes: 3 additions & 6 deletions tests/engine/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,11 @@ def test_tags(self):
def test_default_task_settings(self):
assert wf.default_task_settings is not None

def test_health_settings(self):
def test_health_settings(self):
assert wf.health == {
"rules": [
{
"metric": "RUN_DURATION_SECONDS",
"op": "GREATER_THAN",
"value": 7200
} ]
{"metric": "RUN_DURATION_SECONDS", "op": "GREATER_THAN", "value": 7200}
]
}

def test_user(self):
Expand Down

0 comments on commit 44e4e9e

Please sign in to comment.