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

Rename "bucket" to "gcs_bucket" in GCSToS3Operator #33031

Merged

Conversation

hankehly
Copy link
Contributor

@hankehly hankehly commented Aug 2, 2023

Related: #32760

This pull request renames bucket to gcs_bucket on the GCSToS3Operator class to distinguish between AWS and GCP buckets. The change supports both parameter names but issues a deprecation warning for bucket.

Here are the corresponding unit/system tests:

# Unit tests
pytest tests/providers/amazon/aws/transfers/test_gcs_to_s3.py

# System tests (fill out the below env vars beforehand)
export AWS_ACCESS_KEY_ID=***
export AWS_SECRET_ACCESS_KEY=***
export AWS_DEFAULT_REGION=***
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
export GCP_PROJECT_ID=***
pytest --system amazon tests/system/providers/amazon/aws/example_gcs_to_s3.py

Your review is appreciated.

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Aug 2, 2023
@hankehly hankehly changed the title Change declaration Rename "bucket" to "gcs_bucket" in GCSToS3Operator Aug 2, 2023
@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 17, 2023
@@ -117,7 +120,21 @@ def __init__(
) -> None:
super().__init__(**kwargs)

self.bucket = bucket
if bucket and gcs_bucket:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bucket is still accepted, but outputs a deprecation warning.

@hankehly hankehly marked this pull request as ready for review September 17, 2023 07:53
@hankehly
Copy link
Contributor Author

@ferruzzi This is the PR we briefly talked about in this other issue. I would appreciate your review.

@eladkal eladkal removed the stale Stale PRs per the .github/workflows/stale.yml policy file label Sep 17, 2023
@@ -117,7 +119,23 @@ def __init__(
) -> None:
super().__init__(**kwargs)

self.bucket = bucket
if bucket and gcs_bucket:
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this check? If both are provided, we should use gcs_bucket IMO. To me we should do (pseudo code):

if bucket:
  warnings.warn()
  self.gcs_bucket = bucket

if gcs_bucket:
  self.gcs_bucket = gcs_bucket

As such, if both are provided, gcs_bucket is used

raise ValueError("You must pass either bucket or gcs_bucket.")
# The bucket attribute is unused, but must be set on the operator instance in
# order to include it in template_fields.
self.bucket = None
Copy link
Contributor

Choose a reason for hiding this comment

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

No longer needed?

@hankehly hankehly requested a review from vincbeck September 25, 2023 12:19
@hankehly hankehly requested a review from vincbeck September 25, 2023 22:57
@vincbeck vincbeck merged commit b6499ac into apache:main Sep 26, 2023
@hankehly hankehly deleted the feature/change-declaration-gcs-to-s3-operator branch September 26, 2023 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers provider:amazon AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants