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

update openlineage to avoid deprecation warning #1449

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

CorsettiS
Copy link
Contributor

Description

openlineage suggests using event_v2 as the new import call. This can be seen in the source code of openlineage itself for the run method.

Related Issue(s)

UserWarning: {message : DeprecationWarning('This module is deprecated. Please use openlineage.client.event_v2.'), category : 'DeprecationWarning', filename : '/home/airflow/.local/lib/python3.10/site-packages/openlineage/client/filter.py', lineno : 9, line : None}

Breaking Change?

No

Checklist

  • I have made corresponding changes to the documentation (if required)
  • I have added tests that prove my fix is effective or that my feature works

openlineage suggests using event_v2 as the new import call 

UserWarning: {message : DeprecationWarning('This module is deprecated. Please use `openlineage.client.event_v2`.'), category : 'DeprecationWarning', filename : '/home/airflow/.local/lib/python3.10/site-packages/openlineage/client/filter.py', lineno : 9, line : None}
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 13, 2025
Copy link

netlify bot commented Jan 13, 2025

Deploy Preview for sunny-pastelito-5ecb04 ready!

Name Link
🔨 Latest commit bc947ae
🔍 Latest deploy log https://app.netlify.com/sites/sunny-pastelito-5ecb04/deploys/678a15023843aa00089bc613
😎 Deploy Preview https://deploy-preview-1449--sunny-pastelito-5ecb04.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@dosubot dosubot bot added the area:lineage Related to open lineage or DBT dataset lineage label Jan 13, 2025
@@ -46,7 +46,7 @@
if TYPE_CHECKING:
from airflow.datasets import Dataset # noqa: F811
from dbt.cli.main import dbtRunner, dbtRunnerResult
from openlineage.client.run import RunEvent
from openlineage.client.event_v2 import RunEvent
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are planning to do this, we may have to upgrade open lineage dependency

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is important we support the old version of the OL package and the new, perhaps using a try/catch exception statement.

Also, if possible, we'd add some test. Perhaps we could have a subset of the tests using an older version of OL, eg.:
https://github.com/astronomer/astronomer-cosmos/blob/main/.github/workflows/test.yml#L270

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, +1 to something like

try:
    from openlineage.client.event_v2 import RunEvent
except ImportError:
    from openlineage.client.run import RunEvent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pankajkoti fair enough, I have added the try-except condition. It seems like a very small case to add subsets of tests on top of it IMO tho

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks @CorsettiS . Can we then add # pragma: no cover to ignore those lines from test coverage so that the CI gets green?

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.

This is really helpful, @CorsettiS , thank you very much for pointing this out and submitting a fix. I left some minor feedback in-line

@@ -46,7 +46,7 @@
if TYPE_CHECKING:
from airflow.datasets import Dataset # noqa: F811
from dbt.cli.main import dbtRunner, dbtRunnerResult
from openlineage.client.run import RunEvent
from openlineage.client.event_v2 import RunEvent
Copy link
Collaborator

Choose a reason for hiding this comment

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

It is important we support the old version of the OL package and the new, perhaps using a try/catch exception statement.

Also, if possible, we'd add some test. Perhaps we could have a subset of the tests using an older version of OL, eg.:
https://github.com/astronomer/astronomer-cosmos/blob/main/.github/workflows/test.yml#L270

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 96.87%. Comparing base (768a0b9) to head (8f4d2bd).

Files with missing lines Patch % Lines
cosmos/operators/local.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1449      +/-   ##
==========================================
- Coverage   96.94%   96.87%   -0.07%     
==========================================
  Files          73       73              
  Lines        4355     4358       +3     
==========================================
  Hits         4222     4222              
- Misses        133      136       +3     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:lineage Related to open lineage or DBT dataset lineage size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants