Skip to content

Commit

Permalink
[Tidy-First] Fix node_status for hooks (#10845)
Browse files Browse the repository at this point in the history
  • Loading branch information
aranke authored Oct 14, 2024
1 parent 40c350f commit ef9abe6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@ def safe_run_hooks(
status = RunStatus.Skipped
message = f"{hook_name} skipped"

hook.update_event_status(node_status=status)

self.node_results.append(
RunResult(
status=status,
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/adapter/hooks/test_on_run_hooks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest

from dbt.artifacts.schemas.results import RunStatus
from dbt.contracts.graph.nodes import HookNode
from dbt.tests.util import get_artifact, run_dbt_and_capture


Expand Down Expand Up @@ -49,6 +50,11 @@ def test_results(self, project, log_counts, my_model_run_status):
]

assert [(result.node.unique_id, result.status) for result in results] == expected_results
assert [
(result.node.unique_id, result.node.node_info["node_status"])
for result in results
if isinstance(result.node, HookNode)
] == [(id, str(status)) for id, status in expected_results if id.startswith("operation")]
assert log_counts in log_output
assert "4 project hooks, 1 view model" in log_output

Expand Down

0 comments on commit ef9abe6

Please sign in to comment.