-
Notifications
You must be signed in to change notification settings - Fork 180
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
Use returncode
instead of stderr
to determine dbt graph loading errors
#547
Use returncode
instead of stderr
to determine dbt graph loading errors
#547
Conversation
👷 Deploy Preview for amazing-pothos-a3bca0 processing.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @cliff-lau-cloverhealth , this is looking great; thanks for your contribution!
Please, could you add tests covering this behaviour? It also seems that at least one of the integration tests is failing due to the change: https://github.com/astronomer/astronomer-cosmos/actions/runs/6230291932/job/16926077144?pr=547
We'll aim to release this in 1.1.2.
Hi @tatiana, just pushed some fixes for the integration tests. I have also added two dedicated cases to test for:
However I have difficulties setting up the environment for integration testing locally. It would be nice if you can try to run them through CI. |
Thanks a lot, @cliff-lau-cloverhealth ! I just authorised to run the integration test from this branch:
https://github.com/astronomer/astronomer-cosmos/actions/runs/6244170191/job/17063251829?pr=547 Which issues did you have running the integration tests locally? Please reach out in the Airflow stack channel, and I can support you getting it to work locally. |
I am actually running into this issue now. So looking forward to get it merged 💪 |
@tatiana, I just fixed my local integration test setup and got those pass locally. Could you please authorize the CI to run the integration tests again? Thank you for the back and forth. The problem with the setup was that the default It does not seem to make much sense to default a propietary service in an open source project and impose unnecessary barrier for new contributors - is there a particular reason to do so? On the contrary, the dbt project Moreover, it is not mentioned in the contributing guide at the time I write this comment. |
Hi @cliff-lau-cloverhealth , I'm sorry you ran into those issues. Thank you for all the constructive feedback!
🎉 That's great, thank you!
👍
I fully agree we need to improve the documentation. I logged a ticket so we don't forget this #555. As I documented in this ticket, unfortunately, dbt Python models currently (26 September 2023) only run on specific proprietary platforms:
Since we introduced this feature, we wanted to have an (optional to run) integration test to cover them. If contributors run: Unit tests:
Integration tests:
They do not depend on Databricks. Databricks tests should run only as part of:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for working on this, @cliff-lau-cloverhealth ! Thanks for adding tests, and I'm sorry about the issues running integration tests locally.
Overall, it feels a bit fragile how dbt / dbt plugins currently deal with stdout and stderr. Stderr is used when there are no errors, and stdout is used when there are actual errors without a non-zero code. There have been discussions within the dbt community about this: dbt-labs/dbt-core#5142. Ideally, we'd also improve this in the source.
Your contribution makes Cosmos more reliable and error-proof by using the error codes. It is unlikely we'd have something in the stderr without the adequate error code.
I'll merge this change once the tests pass.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #547 +/- ##
=======================================
Coverage 92.41% 92.42%
=======================================
Files 49 49
Lines 1952 1954 +2
=======================================
+ Hits 1804 1806 +2
Misses 148 148
☔ View full report in Codecov by Sentry. |
Bug fixes * Fix using ``ExecutionMode.KUBERNETES`` by @pgoslatara and @tatiana in #554 * Add support to ``apache-airflow-providers-cncf-kubernetes < 7.4.0`` by @tatiana in #553 * Improve error message in ``config.py`` by @meyobagero in #532 * Use ``returncode`` instead of ``stderr`` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Fix only create task group and test task only if model has test by @raffifu in #543 * Fix ``on_warning_callback`` behaviour on ``DbtTestLocalOperator`` by @edgga, @marco9663 and @tatiana in #558 * Fix ``DbtTestOperator`` when test does not have ``test_metadata`` by @tatiana in #558 * Fix ``target-path`` not specified issue in ``dbt-project.yml`` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546
…rrors (#547) Before, `DbtGraph.load_via_dbt_ls` raises `CosmosLoadDbtException` whenever `stderr` is not empty. This behavior does not seem consistent, as non-blocking warnings can still make `cosmos` refuse to continue. A specific case that I encountered is an OpenBLAS warning that is produced by `podman` and [`composer-local-dev`](https://github.com/GoogleCloudPlatform/composer-local-dev): ``` OpenBLAS WARNING - could not determine the L2 cache size on this system, assuming 256k ``` This warning does not affect how `dbt` works, but `cosmos` still throws out an exception. This PR solves this.
Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Improve error message in `config.py` by @meyobagero in #532 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546
Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Improve error message in `config.py` by @meyobagero in #532 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546
Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Improve error message in `config.py` by @meyobagero in #532 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546 (cherry picked from commit 427f713)
Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Improve error message in `config.py` by @meyobagero in #532 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546 (cherry picked from commit 427f713) (cherry picked from commit 61e4460)
This PR is a subset of the actual Release 1.1.2 (#560), since - for this release - we had to revert a [commit](#560 (comment)) which we don't intend to revert on the project's main branch. Bug fixes * Fix using `ExecutionMode.KUBERNETES` by @pgoslatara and @tatiana in #554 * Add support to `apache-airflow-providers-cncf-kubernetes < 7.4.0` by @tatiana in #553 * Fix `on_warning_callback` behaviour on `DbtTestLocalOperator` by @edgga, @marco9663 and @tatiana in #558 * Use `returncode` instead of `stderr` to determine dbt graph loading errors by @cliff-lau-cloverhealth in #547 * Improve error message in `config.py` by @meyobagero in #532 * Fix `DbtTestOperator` when test does not have `test_metadata` by @tatiana in #558 * Fix `target-path` not specified issue in `dbt-project.yml` by @tatiana in #533 Others * Docs: add reference links to dbt and Airflow columns by @TJaniF in #542 * pre-commit updates #552 and #546
Thanks for the work on this issue. I am somehow still running into this error
I am using 1.1.2 |
Description
Currently,
DbtGraph.load_via_dbt_ls
raisesCosmosLoadDbtException
wheneverstderr
is not empty.This behavior does not seem consistent, as non-blocking warnings can still make
cosmos
refuse to continue.A specific case that I encountered is an OpenBLAS warning that is produced by
podman
andcomposer-local-dev
on MacOS:This warning does not affect how
dbt
works, butcosmos
still throws out an exception.Related Issue(s)
N/A
Breaking Change?
No
Checklist