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] Relationship tests show up with TestBehaviour.NONE #1444

Open
1 task done
roydobbe opened this issue Jan 9, 2025 · 5 comments
Open
1 task done

[Bug] Relationship tests show up with TestBehaviour.NONE #1444

roydobbe opened this issue Jan 9, 2025 · 5 comments
Labels
area:rendering Related to rendering, like Jinja, Airflow tasks, etc bug Something isn't working dbt:test Primarily related to dbt test command or functionality execution:virtualenv Related to Virtualenv execution environment triage-needed Items need to be reviewed / assigned to milestone

Comments

@roydobbe
Copy link

roydobbe commented Jan 9, 2025

Astronomer Cosmos Version

1.8.1

dbt-core version

1.8.1

Versions of dbt adapters

dbt-synapse 1.8.1

LoadMode

DBT_LS_MANIFEST

ExecutionMode

VIRTUALENV

InvocationMode

SUBPROCESS

airflow version

2.10.4

Operating System

If a you think it's an UI issue, what browsers are you seeing the problem on?

No response

Deployment

Astronomer

Deployment details

No response

What happened?

After upgrading to Cosmos 1.8.1, relationship tests show up in our TaskGroup even when we set TestBehaviour to NONE

These tasks dont' seem to do anything according to the logs

Example:

DbtTaskGroup(
        group_id=f"dbt_{select.replace(':', '_')}",
        project_config=ProjectConfig(
            "/usr/local/airflow/dags/dbt/dwh",
            manifest_path="/usr/local/airflow/dags/dbt/dwh/target/manifest.json",
            dbt_vars=dbt_vars,
        ),
        profile_config=profile_config(conn_id=conn_id, threads=dbt_threads),
        execution_config=ExecutionConfig(
            dbt_executable_path=f"{os.environ['AIRFLOW_HOME']}/dbt_synapse_venv/bin/dbt",
        ),
        operator_args={
            "install_deps": True,
            "queue": queue,
            "pool": pool,
            "full_refresh": full_refresh,
            "dbt_cmd_global_flags": ["--cache-selected-only"],
            "callback": upload_run_results_to_blob,
        },
        render_config=RenderConfig(
            test_behavior=TestBehaviour.NONE,
            select=[select],
            load_method=LoadMode.DBT_MANIFEST,
        ),
    )

Image

tests are set up as followed:

  - name: id_xxxx
    tests:
      - not_null
      - relationships:
          to: ref("xxxx")
          field: id_xxx
          config:
            severity: warn

Relevant log output

[2025-01-09, 08:34:42 UTC] {subprocess.py:69} INFO - Running command: ['/usr/local/airflow/dbt_synapse_venv/bin/dbt', '--cache-selected-only', 'test', '--select', 'relationships_xxxxx_.9cfd2fe2b2', '--project-dir', '/tmp/tmpixf6fax3', '--profiles-dir', '/tmp/cosmos/profile/285a0243edc54fe25029a3036fd18e30e9c849ec11b682e8466e2a606f8afde3', '--profile', 'default', '--target', 'dev']
[2025-01-09, 08:34:42 UTC] {subprocess.py:80} INFO - Command output:
[2025-01-09, 08:34:44 UTC] {subprocess.py:90} INFO - 08:34:44  Running with dbt=1.9.1
[2025-01-09, 08:34:45 UTC] {subprocess.py:90} INFO - 08:34:45  Registered adapter: synapse=1.8.1
[2025-01-09, 08:35:13 UTC] {subprocess.py:90} INFO - 08:35:13  Found 829 models, 68 snapshots, 1911 data tests, 17 seeds, 225 sources, 8 exposures, 777 macros, 1 group
[2025-01-09, 08:35:13 UTC] {subprocess.py:90} INFO - 08:35:13  The selection criterion 'relationships_xxxxx_.9cfd2fe2b2' does not match any enabled nodes
[2025-01-09, 08:35:13 UTC] {subprocess.py:90} INFO - 08:35:13  Nothing to do. Try checking your model configs and model specification args
[2025-01-09, 08:35:15 UTC] {subprocess.py:94} INFO - Command exited with return code 0
[2025-01-09, 08:35:15 UTC] {local.py:391} INFO - 08:35:13  Nothing to do. Try checking your model configs and model specification args

How to reproduce

Create a task group using a dbt run command for a tag. Set the testbehaviour to TestBehaviour.NONE

Anything else :)?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Contact Details

No response

@roydobbe roydobbe added bug Something isn't working triage-needed Items need to be reviewed / assigned to milestone labels Jan 9, 2025
Copy link

dosubot bot commented Jan 9, 2025

Hey @roydobbe! I'm here to help you with your Cosmos issue. Let's squash this bug together! 🤖

The issue you're experiencing, where relationship tests appear in the TaskGroup despite setting TestBehaviour to NONE, seems to be unexpected behavior in Cosmos 1.8.1. The TestBehaviour.NONE setting is supposed to exclude tests entirely [1].

This could be due to a bug or oversight in the codebase that doesn't properly respect the TestBehaviour.NONE setting for relationship tests. Unfortunately, I couldn't find specific logic in the Cosmos codebase that overrides this setting and includes relationship tests in the TaskGroup [1].

Since you're willing to submit a PR, you might want to investigate the part of the code that handles the inclusion of tests in the TaskGroup. Checking how the test_behavior parameter is applied in the DbtTaskGroup class and ensuring it correctly excludes all tests when set to NONE would be a good starting point.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added area:rendering Related to rendering, like Jinja, Airflow tasks, etc dbt:test Primarily related to dbt test command or functionality execution:virtualenv Related to Virtualenv execution environment labels Jan 9, 2025
@pankajkoti
Copy link
Contributor

pankajkoti commented Jan 9, 2025

Thank you for reporting this issue, @roydobbe. Could you confirm if this issue started occurring after upgrading to the latest version 1.8.1? Additionally, could you share the previous version of Cosmos you were using before the upgrade (if that did not have this issue)?

@roydobbe
Copy link
Author

roydobbe commented Jan 9, 2025

Hi @pankajkoti,

We came from 1.5.1, upgraded because I was waiting on the callback adjustment 1.8 brought.
I can confirm this issue didnt exist in 1.5.1

@pankajkoti
Copy link
Contributor

@roydobbe Could you please try 1.8.0 instead of 1.8.1 and see if the issue does not occur for 1.8.0?

@roydobbe
Copy link
Author

roydobbe commented Jan 9, 2025

@pankajkoti Just did, the issue does not occur on 1.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rendering Related to rendering, like Jinja, Airflow tasks, etc bug Something isn't working dbt:test Primarily related to dbt test command or functionality execution:virtualenv Related to Virtualenv execution environment triage-needed Items need to be reviewed / assigned to milestone
Projects
None yet
Development

No branches or pull requests

2 participants