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

fix: full_refresh unsused in test operators #590

Merged
merged 4 commits into from
Oct 13, 2023

Conversation

EgorSemenov
Copy link
Contributor

Description

https://apache-airflow.slack.com/archives/C059CC42E9W/p1696857998959909

Related Issue(s)

issue 589

Breaking Change?

Details

airflow.exceptions.AirflowException: Invalid arguments were passed to DbtTestLocalOperator (task_id: test). Invalid arguments were:
**kwargs: {'full_refresh': True}

@EgorSemenov EgorSemenov requested a review from a team as a code owner October 10, 2023 11:47
@EgorSemenov EgorSemenov requested a review from a team October 10, 2023 11:47
@netlify
Copy link

netlify bot commented Oct 10, 2023

👷 Deploy Preview for amazing-pothos-a3bca0 processing.

Name Link
🔨 Latest commit 5114a57
🔍 Latest deploy log https://app.netlify.com/sites/amazing-pothos-a3bca0/deploys/65291ad050bd6e0008eab274

@pre-commit-ci pre-commit-ci bot temporarily deployed to external October 10, 2023 11:47 Inactive
Copy link
Collaborator

@tatiana tatiana left a 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 being so quick at writing the fix for this issue, @EgorSemenov !

We must also write a test to ensure we don't make future changes that will break this feature.

We could change dev/dags/basic_cosmos_dag.py to have:

operator_args={"install_deps": True, "full_refresh": True},

And we could also extend this test:

def test_operator_execute_with_flags(mock_build_and_run_cmd, operator_class, kwargs, expected_call_kwargs):
task = operator_class(profile_config=profile_config, task_id="my-task", project_dir="my/dir", **kwargs)
task.execute(context={})
mock_build_and_run_cmd.assert_called_once_with(**expected_call_kwargs)

To confirm that by passing full_refresh to the DbtTestLocalOperator, it doesn't add it to the generated command - WDTY? This way, we can confirm from an integration & unit test perspective the feature is what we want it to be.

@egorsemionov
Copy link

@tatiana yes, I agree

@pre-commit-ci pre-commit-ci bot temporarily deployed to external October 10, 2023 20:30 Inactive
@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (a073ecc) 92.80% compared to head (5114a57) 92.87%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #590      +/-   ##
==========================================
+ Coverage   92.80%   92.87%   +0.06%     
==========================================
  Files          49       51       +2     
  Lines        2002     2020      +18     
==========================================
+ Hits         1858     1876      +18     
  Misses        144      144              
Files Coverage Δ
cosmos/operators/local.py 90.90% <100.00%> (+0.02%) ⬆️
cosmos/profiles/__init__.py 96.29% <100.00%> (+0.14%) ⬆️
cosmos/profiles/athena/__init__.py 100.00% <100.00%> (ø)
cosmos/profiles/athena/access_key.py 100.00% <100.00%> (ø)

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

@EgorSemenov EgorSemenov temporarily deployed to external October 13, 2023 10:24 — with GitHub Actions Inactive
Copy link
Collaborator

@tatiana tatiana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @EgorSemenov , we'll release this fix as part of 1.2! 🎉

@tatiana tatiana merged commit a426dd2 into astronomer:main Oct 13, 2023
39 checks passed
@tatiana tatiana mentioned this pull request Oct 13, 2023
tatiana added a commit that referenced this pull request Oct 13, 2023
**Features**

* Add support to model versioning available since dbt 1.6 by @binhnq94
in #516
* Add AWS Athena profile mapping by @benjamin-awd in #578
* Support customizing how dbt nodes are converted to Airflow by @tatiana
in #503
* Make the arg ``dbt_project_path`` in the ``ProjectConfig`` optional by
@MrBones757 in #581

**Bug fixes**

* Fix Cosmos custom selector to support filtering a single model by
@jlaneve and @harels in #576
* Fix using ``GoogleCloudServiceAccountDictProfileMapping`` together
with ``LoadMethod.DBT_LS`` by @joppevos in #587
* Fix using the ``full_refresh`` argument in projects that contain tests
by @EgorSemenov and @tatiana in #590
* Stop creating symbolic links for ``dbt_packages`` (solves
``LocalExecutor`` concurrency issue) by @tatiana in #600

**Others**

* Docs: add reference to original Jaffle Shop project by @erdos2n in
#583
* Docs: retries & note about DagBag error by @TJaniF in #592
* pre-commit updates in #575 and #585
tatiana added a commit that referenced this pull request Sep 21, 2024
… (and others) (#1175)

#590 added a fix to
consume the kwargs `full_refresh_ignore` if it wasn't consumed by a
higher class as it was preventing the use of test in the DbtTaskGroup if
`full_refresh_ignore` was set. The previous patch fixed this by
consuming the variable for the `DbtLocalBaseOperator`, leaving a bug in
kubernetes and docker operator. Since `AbstractDbtBaseOperator` has been
added as a base of `DbtDockerBaseOperator`, `DbtKubernetesBaseOperator`
and `DbtLocalBaseOperator`, moving the code there will fix all three.

Fixes #1062

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
ags-de pushed a commit to ags-de/astronomer-cosmos that referenced this pull request Sep 24, 2024
… (and others) (astronomer#1175)

astronomer#590 added a fix to
consume the kwargs `full_refresh_ignore` if it wasn't consumed by a
higher class as it was preventing the use of test in the DbtTaskGroup if
`full_refresh_ignore` was set. The previous patch fixed this by
consuming the variable for the `DbtLocalBaseOperator`, leaving a bug in
kubernetes and docker operator. Since `AbstractDbtBaseOperator` has been
added as a base of `DbtDockerBaseOperator`, `DbtKubernetesBaseOperator`
and `DbtLocalBaseOperator`, moving the code there will fix all three.

Fixes astronomer#1062

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tatiana Al-Chueyr <tatiana.alchueyr@gmail.com>
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.

3 participants