Skip to content

Commit

Permalink
Fix indentation of _safe_run_hook
Browse files Browse the repository at this point in the history
In 9731eaa when splitting out the hook execution logic I screwed up
the indentation of most of the logic 🙈 This fixes that
  • Loading branch information
QMalcolm committed Oct 30, 2024
1 parent 9731eaa commit 6358aff
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions core/dbt/task/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,31 +656,31 @@ def _safe_run_hook(
with collect_timing_info("compile", timing.append):
sql = self.get_hook_sql(adapter, hook, hook.index, num_hooks, extra_context)

Check warning on line 657 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L656-L657

Added lines #L656 - L657 were not covered by tests

started_at = timing[0].started_at or datetime.utcnow()
hook.update_event_status(
started_at=started_at.isoformat(), node_status=RunningStatus.Started
)
started_at = timing[0].started_at or datetime.utcnow()
hook.update_event_status(

Check warning on line 660 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L659-L660

Added lines #L659 - L660 were not covered by tests
started_at=started_at.isoformat(), node_status=RunningStatus.Started
)

fire_event(
LogHookStartLine(
statement=hook_name,
index=hook.index,
total=num_hooks,
node_info=hook.node_info,
)
fire_event(

Check warning on line 664 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L664

Added line #L664 was not covered by tests
LogHookStartLine(
statement=hook_name,
index=hook.index,
total=num_hooks,
node_info=hook.node_info,
)
)

with collect_timing_info("execute", timing.append):
status, message = get_execution_status(sql, adapter)
with collect_timing_info("execute", timing.append):
status, message = get_execution_status(sql, adapter)

Check warning on line 674 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L673-L674

Added lines #L673 - L674 were not covered by tests

finished_at = timing[1].completed_at or datetime.utcnow()
hook.update_event_status(finished_at=finished_at.isoformat())
execution_time = (finished_at - started_at).total_seconds()
finished_at = timing[1].completed_at or datetime.utcnow()
hook.update_event_status(finished_at=finished_at.isoformat())
execution_time = (finished_at - started_at).total_seconds()

Check warning on line 678 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L676-L678

Added lines #L676 - L678 were not covered by tests

if status == RunStatus.Success:
message = f"{hook_name} passed"
else:
message = f"{hook_name} failed, error:\n {message}"
if status == RunStatus.Success:
message = f"{hook_name} passed"

Check warning on line 681 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L680-L681

Added lines #L680 - L681 were not covered by tests
else:
message = f"{hook_name} failed, error:\n {message}"

Check warning on line 683 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L683

Added line #L683 was not covered by tests

return (status, message, execution_time)

Check warning on line 685 in core/dbt/task/run.py

View check run for this annotation

Codecov / codecov/patch

core/dbt/task/run.py#L685

Added line #L685 was not covered by tests

Expand Down

0 comments on commit 6358aff

Please sign in to comment.