Skip to content

Release 1.2.0#600

Merged
tatiana merged 1 commit into
mainfrom
release-1.2
Oct 13, 2023
Merged

Release 1.2.0#600
tatiana merged 1 commit into
mainfrom
release-1.2

Conversation

@tatiana
Copy link
Copy Markdown
Collaborator

@tatiana tatiana commented Oct 13, 2023

Features

Bug fixes

Others

@sweep-ai-deprecated
Copy link
Copy Markdown

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 13, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit eb851fb
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/6529a342593090000869d2e3

@tatiana tatiana temporarily deployed to internal October 13, 2023 19:09 — with GitHub Actions Inactive
@tatiana tatiana marked this pull request as ready for review October 13, 2023 19:10
@tatiana tatiana requested a review from a team as a code owner October 13, 2023 19:10
@tatiana tatiana requested a review from a team October 13, 2023 19:10
@tatiana tatiana added this to the 1.2.0 milestone Oct 13, 2023
@tatiana tatiana temporarily deployed to internal October 13, 2023 19:23 — with GitHub Actions Inactive
@tatiana tatiana temporarily deployed to internal October 13, 2023 19:51 — with GitHub Actions Inactive
@tatiana tatiana temporarily deployed to internal October 13, 2023 19:57 — with GitHub Actions Inactive
@tatiana tatiana temporarily deployed to internal October 13, 2023 20:06 — with GitHub Actions Inactive
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 13, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (5ae38f6) 93.13% compared to head (eb851fb) 93.13%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #600   +/-   ##
=======================================
  Coverage   93.13%   93.13%           
=======================================
  Files          51       51           
  Lines        2053     2053           
=======================================
  Hits         1912     1912           
  Misses        141      141           
Files Coverage Δ
cosmos/__init__.py 100.00% <100.00%> (ø)
cosmos/dbt/graph.py 98.79% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tatiana tatiana merged commit d61f120 into main Oct 13, 2023
@tatiana tatiana deleted the release-1.2 branch October 13, 2023 21:32
tatiana added a commit that referenced this pull request Apr 16, 2025
…` during DAG parsing (#1668)

Support running `dbt deps` incrementally to pre-calculated
`dbt_packages` during DAG parsing. This was a use case requested by an
Astro customer.

Before this change, Cosmos supported two types of configuration:
* If users choose `RenderConfig. dbt_deps=False` or
`ProjectConfig.install_dbt_deps=False`, Cosmos would create a symbolic
link for the user's pre-defined `dbt_packages` (background: #488, #600,
#730)
* If users choose `RenderConfig. dbt_deps=True` or
`ProjectConfig.install_dbt_deps=True` (default), Cosmos would ignore any
user-predefined ' dbt_packages` and do a run `dbt deps` from scratch
from a temporary folder.

An Astronomer customer requested to reuse the defined initially
`dbt_packages` directory and run `dbt deps` (incrementally).

We do not run dbt commands directly in the original dbt project folder
with Cosmos because some users use read-only filesystems (#414). We also
decided to use symbolic links instead of copying the directory due to
performance issues (#488). Since we did not want to introduce a breaking
change in a minor Cosmos release by changing the existing Cosmos 1.x
behaviour to meet this new use case, this PR supports:
* Copying the dbt deps related files (dbt packages folder and symbolic
link) to the Cosmos temporary folder; and
* Running `dbt deps`.

So this is not a breaking change, users must opt into this behaviour by
either:
- Changing individual `DbtDag` or `DbtTaskGroup` instances, using
`ProjectConfig.copy_dbt_packages=True` (new configuration) and
`RenderConfig. dbt_deps=True` or `ProjectConfig.install_dbt_deps=True`;
or
- Changing the behaviour globally, by setting the Airflow configuration
either via the environment variable
`AIRFLOW__COSMOS__DEFAULT_COPY_DBT_PACKAGES_VALUE=True`. or via the
`airflow.cfg`:
```
[cosmos]
default_copy_dbt_packages_value=True
```

The following two missing parts are being added as part of a separate
PR:
- Mimic this behaviour during task execution;
- Update documentation to be representative of both changes.

Depends on #1669 

Related to: #1630
tatiana added a commit that referenced this pull request Apr 16, 2025
…` during task execution (#1670)

Support running `dbt deps` incrementally to pre-calculated
`dbt_packages` during the task execution. This was a use case requested
by an Astro customer.

Before this change, Cosmos supported two types of configuration:
* If users choose `operator_args={"install_deps": False}` or
`ProjectConfig.install_dbt_deps=False`, Cosmos would create a symbolic
link for the user's pre-defined `dbt_packages` (background: #488, #600,
#730)
* If users choose `operator_args={"install_deps": True}` or
`ProjectConfig.install_dbt_deps=True` (default), Cosmos would ignore any
user-predefined ' dbt_packages` and do a run `dbt deps` from scratch
from a temporary folder.

An Astronomer customer requested to reuse the defined initially
`dbt_packages` directory and run `dbt deps` (incrementally).

# Implementation

We do not run dbt commands directly in the original dbt project folder
with Cosmos because some users use read-only filesystems (#414). We also
decided to use symbolic links instead of copying the directory due to
performance issues (#488). Since we did not want to introduce a breaking
change in a minor Cosmos release by changing the existing Cosmos 1.x
behaviour to meet this new use case, this PR supports:
* Copying the dbt deps related files (dbt packages folder and symbolic
link) to the Cosmos temporary folder; and
* Running `dbt deps`.

So this is not a breaking change, users must opt into this behaviour by
using `ProjectConfig.copy_dbt_packages=True` (new configuration) and
`operator_args={"install_dbt_deps": True}` or `ProjectConfig.
install_dbt_deps =True` and one of the following:
- Changing the operator to receive the argument `copy_dbt_packages=True`
- Changing individual `DbtDag` or `DbtTaskGroup` instances to use the
new configuration `ProjectConfig.copy_dbt_packages=True`
- Changing the behaviour globally, by setting the Airflow configuration
either via the environment variable
`AIRFLOW__COSMOS__DEFAULT_COPY_DBT_PACKAGES_VALUE=True` or via the
`airflow.cfg`:
```
[cosmos]
default_copy_dbt_packages_value=True
```

# How this was tested

To validate the end-to-end behaviour, we run the following dag from
`dev/dags`:
```
airflow dags test dbt_deps_example
```

# Related tickets

This is a follow-up to #1668 and #1669.

I'll make a follow-up PR covering the documentation.

Closes: #1630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants