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

[CT-1003] run_results.json not generated when on-run-end fails #5625

Closed
2 tasks done
seunghanhong opened this issue Aug 8, 2022 · 3 comments · Fixed by #6059
Closed
2 tasks done

[CT-1003] run_results.json not generated when on-run-end fails #5625

seunghanhong opened this issue Aug 8, 2022 · 3 comments · Fixed by #6059
Labels
artifacts bug Something isn't working support_rotation A good task to pick up during support rotation

Comments

@seunghanhong
Copy link

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

The dbt artifact run_results.json is not generated when a statement in the on-run-end fails. This behavior does not occur when the statement fails in a post-hook.

Expected Behavior

run_results.json must be generated even if a statement fails at the on-run-end and must contain dbt model execution results to indicate which models ran successfully or failed.

Steps To Reproduce

  1. Create a sample dbt project with dbt init
  2. Run dbt build and confirm target/run_results.json exists.
  3. Run dbt clean to remove the target directory.
  4. Add on-run-end: "select col1" in the dbt_project.yml and it causes dbt a Database error.
  5. Run dbt build and confirm target/run_results.json does not exist.

Relevant log output

No response

Environment

- OS: MacOS 12.3.1
- Python: 3.8.5
- dbt: 1.1 and 1.2

Which database adapter are you using with dbt?

postgres, redshift

Additional Context

No response

@seunghanhong seunghanhong added bug Something isn't working triage labels Aug 8, 2022
@github-actions github-actions bot changed the title run_results.json not generated when on-run-end fails [CT-1003] run_results.json not generated when on-run-end fails Aug 8, 2022
@lostmygithubaccount lostmygithubaccount self-assigned this Aug 8, 2022
@lostmygithubaccount lostmygithubaccount removed their assignment Aug 11, 2022
@lostmygithubaccount
Copy link
Contributor

I am able to reproduce this easily enough. This should be fixed. Thanks for reporting @seunghanhong!

Acceptance criteria: runs failing from on-run-end hooks should still results in a run_results.json entry with details on the failure.

@iknox-fa
Copy link
Contributor

N.B. Be sure to check with cloud that the existence of this file isn't being used as a indicator of a successful run.

@jtcohen6
Copy link
Contributor

N.B. Be sure to check with cloud that the existence of this file isn't being used as a indicator of a successful run.

My sense is that:

  • dbt Cloud job scheduler uses the exit code produced by dbt-core's CLI to determine whether the job succeeded. In this case, an error was raised, so it should be a nonzero exit code (error) regardless
  • If run_results.json is not produced, it does prevent the Metadata API from ingesting that artifact and being able to report on that run. Resolution of this ticket will allow the Metadata API to include information about runs with on-run-end hooks that raise errors.

@leahwicz leahwicz added the support_rotation A good task to pick up during support rotation label Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifacts bug Something isn't working support_rotation A good task to pick up during support rotation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants