Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] on-run-end runs before on-run-start on actions other than build #11262

Open
2 tasks done
frankivo opened this issue Jan 31, 2025 · 3 comments
Open
2 tasks done

[Bug] on-run-end runs before on-run-start on actions other than build #11262

frankivo opened this issue Jan 31, 2025 · 3 comments
Labels
bug Something isn't working triage

Comments

@frankivo
Copy link

frankivo commented Jan 31, 2025

Is this a new bug in dbt-core?

  • I believe this is a new bug in dbt-core
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

I have a project with some hooks: both on-run-start and on on-run-end.
Whenever there are models to be run, the order is fine.

However when there no models to be run, the order may be incorrect.
I see the on-run-end hooks running before (or paralel) with on-run-start hooks.

Expected Behavior

I would expect the on-run-end to start after on-run-start is done executing.

Steps To Reproduce

hook config:

on-run-start:
  - "{{ log('Run type: ' + flags.WHICH, info=True) }}"
  - "{{ log('Pre-hook: on-run-start', info=True) }}"

on-run-end:
  - "{{ log('Post-hook: on-run-end', info=True) }}"
  • execute dbt build and check logs (should be correct)
  • execute dbt compile and check logs (may be correct)

tested against dbt-core 1.8.6 and dbt-core 1.9.2

Relevant log output

12:14:47  Running with dbt=1.9.2
12:14:47  Registered adapter: duckdb=1.9.1
12:14:48  Found 1 model, 3 operations, 424 macros
12:14:48  
12:14:48  Concurrency: 1 threads (target='dev')
12:14:48
12:14:48  Post-hook: on-run-end
12:14:48  Run type: compile
12:14:48  Pre-hook: on-run-start

Environment

- OS: Windows 11 24H2
- Python: 3.12.8
- dbt: 1.8.6 / 1.9.2

Which database adapter are you using with dbt?

other (mention it in "Additional Context")

Additional Context

occurs with dbt-databricks and dbt-duckdb. assuming it is not relevant for this issue.

@frankivo frankivo added bug Something isn't working triage labels Jan 31, 2025
@frankivo
Copy link
Author

Demo project available: https://github.com/frankivo/dbt_hooks_debug

@jeremyyeo
Copy link
Contributor

This may be of interest to you: #4785

@frankivo
Copy link
Author

This may be of interest to you: #4785

Thank you! I think I may have only searched open issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants