hankehly commented on code in PR #32760:
URL: https://github.com/apache/airflow/pull/32760#discussion_r1276921742
##########
tests/system/providers/amazon/aws/example_gcs_to_s3.py:
##########
@@ -38,18 +50,40 @@
) as dag:
test_context = sys_test_context_task()
env_id = test_context["ENV_ID"]
+ gcp_user_project = test_context[GCP_PROJECT_ID]
s3_bucket = f"{env_id}-gcs-to-s3-bucket"
s3_key = f"{env_id}-gcs-to-s3-key"
create_s3_bucket = S3CreateBucketOperator(task_id="create_s3_bucket",
bucket_name=s3_bucket)
+ gcs_bucket = f"{env_id}-gcs-to-s3-bucket"
+ gcs_key = f"{env_id}-gcs-to-s3-key"
+
+ create_gcs_bucket = GCSCreateBucketOperator(
+ task_id="create_gcs_bucket",
+ bucket_name=gcs_bucket,
+ resource={"billing": {"requesterPays": True}},
+ project_id=gcp_user_project,
+ )
+
+ @task
+ def upload_gcs_file(bucket_name: str, object_name: str, user_project: str):
+ hook = GCSHook()
+ with hook.provide_file_and_upload(
+ bucket_name=bucket_name,
+ object_name=object_name,
+ user_project=user_project,
+ ) as temp_file:
+ temp_file.write(b"test")
+
# [START howto_transfer_gcs_to_s3]
gcs_to_s3 = GCSToS3Operator(
task_id="gcs_to_s3",
- bucket=s3_bucket,
- dest_s3_key=s3_key,
+ bucket=gcs_bucket,
Review Comment:
That's a good idea. I'd be happy to change the declaration (keeping support
for the old param name and adding a deprecation warning) in another PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]