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

dbt: dbt-ol should transparently exit with the same exit code as the child dbt process #2560

Merged
merged 1 commit into from Apr 3, 2024

Conversation

blacklight
Copy link
Contributor

Problem

See #2558

If dbt-ol doesn't exit with the same code as the child dbt process, then any upstream process(es), including Airflow DAGs, won't be able to detect workflow failures.

Closes: #2558

Solution

dbt-ol.main should return the return_code of the child dbt process, and we should explicitly sys.exit it.

This PR also adds a couple of extra changes to make the code of dbt-ol more PEP/Flake compliant. In particular:

One-line summary:

dbt-ol should transparently exit with the same exit code as the child dbt process.

Checklist

  • You've signed-off your work
  • Your pull request title follows our guidelines
  • [ ] Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
    - [ ] You've updated any relevant documentation (if relevant)
  • Your comment includes a one-liner for the changelog about the specific purpose of the change (if necessary)
    - [ ] You've versioned the core OpenLineage model or facets according to SchemaVer (if relevant)
    - [ ] You've added a header to source files (if relevant)

SPDX-License-Identifier: Apache-2.0
Copyright 2018-2023 contributors to the OpenLineage project

…t code as the underlying dbt process

Also in this commit:

- Use lazy template evaluation instead of f-strings for logging (see
  https://realpython.com/python-f-strings/#lazy-evaluation-in-logging)

- `subprocess.Popen` should always be run through a context manager.

Signed-off-by: Fabio Manganiello <fabio.manganiello@booking.com>
@boring-cyborg boring-cyborg bot added the area:integration/dbt openlineage-dbt label Apr 3, 2024
@JDarDagran JDarDagran merged commit bbc9636 into OpenLineage:main Apr 3, 2024
30 checks passed
Copy link

boring-cyborg bot commented Apr 3, 2024

Great job! Congrats on your first merged pull request in OpenLineage!

blacklight added a commit to blacklight/OpenLineage that referenced this pull request Apr 4, 2024
…t code as the underlying dbt process (OpenLineage#2560)

Also in this commit:

- Use lazy template evaluation instead of f-strings for logging (see
  https://realpython.com/python-f-strings/#lazy-evaluation-in-logging)

- `subprocess.Popen` should always be run through a context manager.

Signed-off-by: Fabio Manganiello <fabio.manganiello@booking.com>
Co-authored-by: Fabio Manganiello <fabio.manganiello@booking.com>
Signed-off-by: Fabio Manganiello <fabio@manganiello.tech>
blacklight added a commit to blacklight/OpenLineage that referenced this pull request Apr 9, 2024
…eage events are emitted.

This is a follow-up [/missed corner case] of
OpenLineage#2560

Signed-off-by: Fabio Manganiello <fabio@manganiello.tech>
mobuchowski pushed a commit that referenced this pull request Apr 9, 2024
… are emitted. (#2591)

This is a follow-up [/missed corner case] of
#2560

Signed-off-by: Fabio Manganiello <fabio@manganiello.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:integration/dbt openlineage-dbt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dbt-ol should transparently propagate the exit code of dbt run
3 participants