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

Improve provider verification pre-commit #33640

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Aug 23, 2023

There were a numer of problems with the provider verification pre-commit scripts:

  • It missed verification of "notifications"
  • It did not check if the classes or modules specified in provider yaml raised deprecation warnings
  • The messages produced by the script when some discrepancies were found were pretty cryptic and it was difficult to guess what kind of action should be taken to fix the problem

This PR fixes all those problems:

  • verification of notification is performed
  • when importing all the classes and modules, check for the AirflowProviderDeprecationWarnings is done and treated as error
  • The messages produced provide clear actionable instructions on what to do and explain what are the discrepancies of expected vs. current list in a clear way

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@potiuk potiuk requested a review from ashb as a code owner August 23, 2023 06:26
@potiuk potiuk requested review from uranusjr and eladkal August 23, 2023 06:26
@potiuk
Copy link
Member Author

potiuk commented Aug 23, 2023

Note! This PR will fail and it will nicely show all the kinds of problems detected by the script now - I am submitting separate PRs to fix problems found here and when we merge them, this one should become green.

potiuk added a commit to potiuk/airflow that referenced this pull request Aug 23, 2023
The Slack Notification listed in provider.yaml for slack has
been still using the deprecated version of it. Since the
provider verification of ours did not check neither notifications
nor warnings, it was not found before.

Found in the attempt of adding new verification in apache#33608 then
also detected by apache#33640 that improved existing verification.
potiuk added a commit to potiuk/airflow that referenced this pull request Aug 23, 2023
@potiuk potiuk force-pushed the improve-provider-verification-pre-commit branch from ff72e9a to eecb68b Compare August 23, 2023 07:01
@potiuk
Copy link
Member Author

potiuk commented Aug 23, 2023

Those are example errors printed now when the script fails:

Screenshot 2023-08-23 at 10 19 27

@potiuk potiuk force-pushed the improve-provider-verification-pre-commit branch from eecb68b to 6fc8a09 Compare August 23, 2023 08:22
potiuk added a commit that referenced this pull request Aug 23, 2023
…33643)

The Slack Notification listed in provider.yaml for slack has
been still using the deprecated version of it. Since the
provider verification of ours did not check neither notifications
nor warnings, it was not found before.

Found in the attempt of adding new verification in #33608 then
also detected by #33640 that improved existing verification.
Copy link
Contributor

@eladkal eladkal left a comment

Choose a reason for hiding this comment

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

Very nice!
Added it as solving an item from #31443

potiuk added a commit that referenced this pull request Aug 23, 2023
potiuk added a commit to potiuk/airflow that referenced this pull request Aug 23, 2023
The Dataproc Links have been deprecated, but they were deprecated
wrongly - the Deprecation Warnings were always raised when the
dataproc module has been deprecated, but only few classes there
were deprecated. This was because the warnings were added as
class-level warnings rather than as warnings in constructors.

Also the deprecated classes have still been used in operators, raising
the warnings even if the deprecation warnings have been moved
from class to it's constructor.

This PR fixes that:

* moves deprecation warnings from classes to constructors
* replaces usage of deprecated links with those links that
  replaced the deprecated ones

Found during implementing of apache#33640
@potiuk potiuk force-pushed the improve-provider-verification-pre-commit branch from 6fc8a09 to 1c03797 Compare August 23, 2023 12:06
There were a numer of problems with the provider verification pre-commit
scripts:

* It missed verification of "notifications"
* It did not check if the classes or modules specified in provider yaml
  raised deprecation warnings
* The messages produced by the script when some discrepancies were found
  were pretty cryptic and it was difficult to guess what kind of action
  should be taken to fix the problem

This PR fixes all those problems:

* verification of notification is performed
* when importing all the classes and modules, check for the
  AirflowProviderDeprecationWarnings is done and treated as error
* The messages produced provide clear actionable instructions on what
  to do and explain what are the discrepancies of expected vs. current
  list in a clear way
@potiuk potiuk force-pushed the improve-provider-verification-pre-commit branch from 1c03797 to 891c701 Compare August 23, 2023 14:48
@potiuk
Copy link
Member Author

potiuk commented Aug 23, 2023

I decided to give up on "undeprecating DataProcLink" for now (too risky) - just added a feature of "Known deprecated classes" instead.

@potiuk
Copy link
Member Author

potiuk commented Aug 23, 2023

Google team will take care about the DataprocLink some time soon-ish cc: @VladaZakharova :)

@potiuk
Copy link
Member Author

potiuk commented Aug 23, 2023

flaky test only, Merging.

@potiuk potiuk merged commit dd218dd into apache:main Aug 23, 2023
@potiuk potiuk deleted the improve-provider-verification-pre-commit branch August 23, 2023 15:36
potiuk added a commit to potiuk/airflow that referenced this pull request Aug 23, 2023
Continuation of apache#33640 - there were one more wrong check in
the provider, that missed "hook-class-names" check
potiuk added a commit that referenced this pull request Aug 23, 2023
Continuation of #33640 - there were one more wrong check in
the provider, that missed "hook-class-names" check
potiuk added a commit to potiuk/airflow that referenced this pull request Aug 24, 2023
This one completes review and check of provider.yaml verifications.
There was one more check - for duplicates - that did not work
as expected. It was hiding errors detected.

This PR fixes it and also adds a bit more diagnostics messagese
on what is actually being checked to give a bit more clue if some
check is not doing what it is supposed to be doing.

Follow up after apache#33662 and apache#33640
potiuk added a commit that referenced this pull request Aug 24, 2023
This one completes review and check of provider.yaml verifications.
There was one more check - for duplicates - that did not work
as expected. It was hiding errors detected.

This PR fixes it and also adds a bit more diagnostics messagese
on what is actually being checked to give a bit more clue if some
check is not doing what it is supposed to be doing.

Follow up after #33662 and #33640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants