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 missing get_backup method for Dataproc Metastore #20326

Merged
merged 1 commit into from
Dec 15, 2021

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Dec 15, 2021

Found during #19891 fixing (yay! MyPy actually found some real errors).

The get_backup method was missing in Dataproc Metastore
implementation.


^ Add meaningful description above

Read the Pull Request Guidelines for more information.
In case of fundamental code change, 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 UPDATING.md.

Found during apache#19891 fixing (yay! MyPy actually found some real errors).

The `get_backup` method was missing in Dataproc Metastore
implementation.
@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Dec 15, 2021
@potiuk potiuk requested review from ashb and mik-laj December 15, 2021 19:54
@potiuk potiuk assigned uranusjr and unassigned uranusjr Dec 15, 2021
@potiuk potiuk requested a review from uranusjr December 15, 2021 19:54
@potiuk
Copy link
Member Author

potiuk commented Dec 15, 2021

Yay! Found a real error thanks to MyPY :)

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Dec 15, 2021
@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@potiuk potiuk merged commit 21b8661 into apache:main Dec 15, 2021
@potiuk potiuk deleted the fix-missing-get-backup branch December 15, 2021 22:50
@potiuk potiuk added the mypy Fixing MyPy problems after bumpin MyPy to 0.990 label Dec 15, 2021
@kaxil kaxil added the changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) label Jan 13, 2022
@lwyszomi
Copy link
Contributor

lwyszomi commented Feb 8, 2022

@potiuk what errors we had without this? because we didn't add this method intentionally.

@potiuk
Copy link
Member Author

potiuk commented Feb 8, 2022

Why Intentionally? It does not look like this was intentional, because it has been called in the operator (in case of error, but it was). It could be that there was another mistake in the operator that called this method - but this did seem like a missing method that is used elsewhere?

        except HttpError as err:
            if err.resp.status not in (409, '409'):
                raise
            self.log.info("Backup %s already exists", self.backup_id)
            backup = hook.get_backup(
                project_id=self.project_id,
                region=self.region,
                service_id=self.service_id,
                backup_id=self.backup_id,
                retry=self.retry,
                timeout=self.timeout,
                metadata=self.metadata,
            )
        return Backup.to_dict(backup)

What do you think is the right fix @lwyszomi ? Should id be replaced with something else here?

@potiuk
Copy link
Member Author

potiuk commented Feb 8, 2022

BTW: we still have a chance to fix it today as I am preparing to publish RC2 for providers - so if this is wrong - it would be great to get a better fix today.

@potiuk
Copy link
Member Author

potiuk commented Feb 8, 2022

BTW ^^ this is what MyPy discovered :). I have no such hawk-eye :)

@lwyszomi
Copy link
Contributor

lwyszomi commented Feb 8, 2022

@potiuk We decided that we should not have a operator for this hook method, I didn't know that we using this in the create backup operator. I don't know how this happen and we didn't discovered this in the tests.

This is really good fix to add this method to the hook.

@potiuk
Copy link
Member Author

potiuk commented Feb 8, 2022

Cool :)

@potiuk
Copy link
Member Author

potiuk commented Feb 8, 2022

Thank MyPy for that, not me :). I merely followed MyPy screaming " pleeeeease add the method " at me.

@potiuk potiuk restored the fix-missing-get-backup branch April 26, 2022 20:48
@potiuk potiuk deleted the fix-missing-get-backup branch July 29, 2022 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers changelog:skip Changes that should be skipped from the changelog (CI, tests, etc..) mypy Fixing MyPy problems after bumpin MyPy to 0.990 okay to merge It's ok to merge this PR as it does not require more tests provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants