Skip to content

Disable CosmosPlugin for AF3#1692

Merged
pankajkoti merged 2 commits into
mainfrom
disable-plugin-for-af3
Apr 25, 2025
Merged

Disable CosmosPlugin for AF3#1692
pankajkoti merged 2 commits into
mainfrom
disable-plugin-for-af3

Conversation

@pankajkoti
Copy link
Copy Markdown
Contributor

@pankajkoti pankajkoti commented Apr 24, 2025

While I am not seeing any explicit errors with having the CosmosPlugin in an Airflow 3 env, I think it's still wise that we disable it for now for Airflow 3 until we work on #1587

closes: #1685

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2025

Deploy Preview for sunny-pastelito-5ecb04 canceled.

Name Link
🔨 Latest commit 0006a8f
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/680a50d2f0be00000860f233

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 24, 2025

Deploying astronomer-cosmos with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0006a8f
Status: ✅  Deploy successful!
Preview URL: https://a54c6974.astronomer-cosmos.pages.dev
Branch Preview URL: https://disable-plugin-for-af3.astronomer-cosmos.pages.dev

View logs

Comment thread cosmos/plugin/__init__.py
@pankajkoti
Copy link
Copy Markdown
Contributor Author

I tested that the plugin continues to work with AF2
Screenshot 2025-04-24 at 8 37 43 PM

@pankajkoti pankajkoti marked this pull request as ready for review April 24, 2025 15:08
@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. area:docs Relating to documentation, changes, fixes, improvement area:plugin Related to the Cosmos AirflowPlugin. labels Apr 24, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.43%. Comparing base (e6f7bb2) to head (0006a8f).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1692   +/-   ##
=======================================
  Coverage   97.42%   97.43%           
=======================================
  Files          80       81    +1     
  Lines        5019     5024    +5     
=======================================
+ Hits         4890     4895    +5     
  Misses        129      129           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pankajkoti
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown
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, @pankajkoti , really excited for the AF3 support!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 25, 2025
@pankajkoti pankajkoti merged commit ced938c into main Apr 25, 2025
74 checks passed
@pankajkoti pankajkoti deleted the disable-plugin-for-af3 branch April 25, 2025 11:09
tatiana pushed a commit that referenced this pull request Apr 28, 2025
Interestingly, while working on PR #1692, I didn’t encounter the
following error initially. However, something in my environment must
have changed—possibly related to the Airflow 3 setup—because I’m now
seeing a plugin load error in the `airflow standalone` logs when using a
Hatch-managed Airflow 3 environment:

```
dag-processor | [2025-04-25T18:51:24.537+0530] {plugins_manager.py:262} ERROR - Failed to import plugin cosmos
dag-processor | Traceback (most recent call last):
dag-processor | File "/Users/pankajkoti/Library/Application Support/hatch/env/virtual/astronomer-cosmos/D9FI7Men/tests.py3.9-3.0-1.9/lib/python3.9/site-packages/airflow/plugins_manager.py", line 254, in load_entrypoint_plugins
dag-processor | plugin_class = entry_point.load()
dag-processor | File "/Users/pankajkoti/Library/Application Support/hatch/env/virtual/astronomer-cosmos/D9FI7Men/tests.py3.9-3.0-1.9/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 213, in load
dag-processor | return functools.reduce(getattr, attrs, module)
dag-processor | AttributeError: module 'cosmos.plugin' has no attribute 'CosmosPlugin'
```

While this doesn’t block DAG execution or general Airflow usage, I
believe it’s still worthwhile to iterate on PR #1692 and explicitly set
the plugin to `None` for Airflow 3.x. This avoids the plugin load error
altogether.

With that change in place, the error is resolved, and the environment
works seamlessly with both Airflow 2 and Airflow 3. I’ve also added a
basic sanity check to ensure that CosmosPlugin is either None or
properly initialized, depending on the Airflow version in use.

related: #1685
@pankajkoti pankajkoti mentioned this pull request Apr 30, 2025
@tatiana tatiana added this to the Cosmos 1.10.0 milestone Apr 30, 2025
tatiana added a commit that referenced this pull request May 1, 2025
Features

* Airflow 3 support
* Support running ``dbt deps`` incrementally to pre-defined
``dbt_packages`` by @tatiana in #1668 and #1670
* Add ``DuckDB`` profile mapping by @prithvijitguha and @pankajastro in
#1553
* Implement DBT exposure selector by ghjklw #1717

Bug Fixes

* Fix ``test_indirect_selection`` flag to be propagated in case of
``TestBehavior.BUILD`` by @corsettigyg in #1663
* Fix ``select`` clause in the case of detached tests by @anyapriya in
#1680
* Operator argument fixes by @johnhoran in #1648


Airflow 3 Support

* Support rendering DbtDag in Airflow 3 by @tatiana and @ashb in #1657
* Refactor Rendered Task Instance Fields (RTIF) handling for Airflow 2.x
and 3.x by @pankajkoti in #1661
* Run cosmos operator in Airflow 3 by @pankajastro in #1642
* Fix ``python_virtualenv.prepare_env`` top-level import for Airflow 3
by @pankajkoti in #1678
* Fix Variable not found issue in Airflow 3 by @tatiana in #1684
* Disable CosmosPlugin on Airflow 3 setup by @pankajkoti in #1692, #1698
* Use ``schedule`` param in example DAGs instead of the 2.10 deprecated
and 3.0 removed ``schedule_interval`` by @pankajkoti in #1701
* Ensure ``virtualenv_dir`` path exists by @pankajkoti in #1724
* Support emitting Assets with Airflow 3 by @tatiana in #1713
* Add docs on Airflow 3 compatibility by @pankajkoti and @tatiana in
#1731
* Introduce, test and document asset/dataset breaking change by @tatiana
in #1672
* Improve dataset/asset driven scheduling documentation by @tatiana in
#1729

Enhancements

* Allow multiple callbacks by @corsettigyg #1693
* Refactor kubernetes warning callback handling by @canbekley in #1681

Documentation

* Add documentation related to ``copy_dbt_packages`` by @tatiana in
#1671
* Make wording and command consistent in the contributing doc by
@pankajkoti in #1697
* Add MonteCarlo callback example for importing dbt artifacts by
@corsettigyg #1695
* Change async feature to be non-experimental by @tatiana in #1732

Others

* Add sample ``dbt_packages`` to validate incremental ``dbt deps`` by
@tatiana in #1669
* Add kubernetes execution mode example in Airflow 3 by @pankajastro in
#1667
* Check only major version until Airflow 3 stable release by
@pankajastro in #1665
* Install Airflow from main branch by @pankajastro in #1660
* Add dev tool for Airflow 3 by @pankajastro and @tatiana in #1627
* Improve Airflow 3 tooling by @pankajastro in #1656
* Skip associating ``openlineage_events_completes`` to ``ti`` in Airflow
3 by @pankajkoti in #1662
* Add .gitignore file for the scripts/airflow3 directory by @pankajkoti
in #1658
* Remove ``original_jaffle_shop`` dbt project by @pankajkoti in #1676
* Fix or ignore type check error by @pankajastro in #1687
* Run virtualenv example with Airflow 3 tooling by @pankajastro in #1686
* Enable running setup/teardown tasks with Async execution DAG with
Airflow 3 tooling by @pankajastro in #1696
* Enable integration tests for the DuckDB adapter by @pankajastro in
#1699
* Add Airflow 3 tests matrix entries in CI by @pankajkoti in #1646
* Use a different way to get tasks count for asserting test_perf_dag by
@pankajkoti in #1714
* Reinstall Airflow 3 dependency on ``pydantic>=2.11`` for dbt adapter
versions 1.6 & 1.9 by @pankajkoti in #1715
* Fix outdated ``echo`` in Airflow 3 tooling script #1700
* Add files not needed for git tracking to .gitignore by @pankajkoti in
#1723
* Use latest minor versions for dbt adapters to get in compatibility
fixes by @pankajkoti in #1719
* Fix Airflow 3 tests raising generate_run_id() takes 0 positional
arguments by @tatiana in #1725
* Fix dataset tests failing in Airflow 3 by @tatiana in #1716
* Enable example DAGs to run in CI that were disabled in PR #1646 by
@pankajkoti in #1726
* Pre-commit updates: #1666, #1653, #1641, #1682, #1720


Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com>
Co-authored-by: Pankaj Singh
<98807258+pankajastro@users.noreply.github.com>

---------

Co-authored-by: Pankaj Koti <pankajkoti699@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Relating to documentation, changes, fixes, improvement area:plugin Related to the Cosmos AirflowPlugin. lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check if we can load cosmos in AF3 with the current plugin and tweak necessarily

2 participants