astronomer / astronomer-cosmos

Run your dbt Core projects as Apache Airflow DAGs and Task Groups with a few lines of code

Home Page:https://astronomer.github.io/astronomer-cosmos/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test task is generated though it is not defined

fithisux opened this issue · comments

My FOSS tutorial project here comes with a README.

https://github.com/fithisux/omdb_scheduled_dbt

job_names_with_types task group has a test.

But I have not defined any.

Side note: the whole dag with cosmos fails, though if I connect to docker and execute the dbt commands (deps, seed, run, test), it does not fail.

To address the unexpected test task generation and the DAG failure in your omdb_scheduled_dbt project, consider the following adjustments:

  1. Unexpected Test Task Generation: This issue might be due to the default test_behavior setting in Cosmos, which automatically generates a test task after each model run. You can modify this behavior by adjusting the test_behavior setting in your Cosmos configuration to a value that suits your project's needs, preventing the automatic generation of test tasks if undesired.

  2. DAG Failure with Cosmos Execution: The failure when executing the DAG with Cosmos, as opposed to manual dbt commands in Docker, suggests a possible misalignment in the execution environment configuration. Ensure that the execution_mode in your Cosmos configuration reflects the actual environment you're using (e.g., Docker). If your project runs in a containerized environment, setting execution_mode to ExecutionMode.DOCKER or similar might resolve the issue.

By reviewing and adjusting the test_behavior and execution_mode settings in your Cosmos configuration, you should be able to align Cosmos's behavior with your project's requirements and resolve the issues you've encountered.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

The change seems to have done the trick

render_config = RenderConfig(
        emit_datasets=False, 
        test_behavior=TestBehavior.AFTER_ALL,
    ),

though, it was not clear to me why the TestBehavior.AFTER_EACH did not work.

Code pushed to the repository above for whoever would like to test.