turbaszek commented on a change in pull request #10947:
URL: https://github.com/apache/airflow/pull/10947#discussion_r491856772



##########
File path: airflow/providers/amazon/aws/example_dags/example_glacier_to_gcs.py
##########
@@ -0,0 +1,68 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+import os
+
+from airflow import models
+from airflow.providers.amazon.aws.sensors.glacier import 
GlacierJobOperationSensor
+from airflow.providers.amazon.aws.transfers.glacier_to_gcs import (
+    GlacierCreateJobOperator,
+    GlacierDownloadArchive,
+    GlacierTransferDataToGCS,
+)
+from airflow.utils.dates import days_ago
+
+VAULT_NAME = "airflow"
+BUCKET_NAME = os.environ.get("GCS_BUCKET_NAME", "gs://glacier_bucket")
+
+with models.DAG(
+    "example_glacier_to_gcs", schedule_interval=None, start_date=days_ago(1),  
# Override to match your needs
+) as dag:
+    # [START howto_glacier_create_job_operator]
+    create_glacier_job = GlacierCreateJobOperator(
+        task_id="create_glacier_job", aws_conn_id="aws_default", 
vault_name=VAULT_NAME,
+    )
+    JOB_ID = '{{ task_instance.xcom_pull("create_glacier_job")["jobId"] }}'

Review comment:
       It may be faster as you read only a single string instead of JSON 
object. But for me, the main point is that I don't have to know the exact 
structure of the returned dictionary. I just need to know that someone already 
extracted the job id from it and saved it in XCom under a key.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to