airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [airflow] potiuk commented on a change in pull request #6773: [AIRFLOW-6038] AWS DataSync example_dags added
Date Wed, 11 Dec 2019 12:24:05 GMT
potiuk commented on a change in pull request #6773: [AIRFLOW-6038] AWS DataSync example_dags
added
URL: https://github.com/apache/airflow/pull/6773#discussion_r356564931
 
 

 ##########
 File path: docs/howto/operator/amazon/aws/datasync.rst
 ##########
 @@ -0,0 +1,155 @@
+ .. 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.
+
+
+.. _howto/operator:AWSDataSyncOperator:
+
+AWS DataSync Operator
+=====================
+
+.. contents::
+  :depth: 1
+  :local:
+
+Overview
+--------
+
+Two example_dags are provided which showcase the 
+:class:`~airflow.providers.amazon.aws.operators.datasync.AWSDataSyncOperator` 
+in action. 
+
+ - example_datasync_simple.py
+ - example_datasync_complex.py
+
+Both examples use the :class:`~airflow.providers.amazon.aws.hooks.datasync.AWSDataSyncHook`

+to create a boto3 'datasync' client. This hook in turn uses the :class:`~airflow.contrib.hooks.aws_hook.AwsHook`
+
+Note this guide differentiates between an Airflow task (identified by a task_id on Airflow),

+and an AWS DataSync Task (identified by a TaskArn on AWS)
+
+example_datasync_simple.py
+--------------------------
+
+Purpose
+"""""""
+Find an AWS DataSync TaskArn based on source and destination URIs, and execute it.
+
+Environment variables
+"""""""""""""""""""""
+
+Get and Run DataSync Tasks
+""""""""""""""""""""""""""
+
+The :class:`~airflow.providers.amazon.aws.operators.datasync.AWSDataSyncOperator` can execute
a specific
+TaskArn by specifying the ``task_arn`` parameter.
+
+.. exampleinclude:: ../../../../../airflow/providers/amazon/aws/example_dags/example_datasync_simple.py
+    :language: python
+    :start-after: [START howto_operator_datasync_simple_args_1]
+    :end-before: [END howto_operator_datasync_simple_args_1]
+
+
+.. exampleinclude:: ../../../../../airflow/providers/amazon/aws/example_dags/example_datasync_simple.py
+    :language: python
+    :start-after: [START howto_operator_datasync_simple_1]
+    :end-before: [END howto_operator_datasync_simple_1]
+
+Or, it can search in AWS DataSync for a Task based on the specified 
+``source_location_uri`` and ``destination_location_uri``. 
+
+In AWS, DataSync Tasks are linked to source and destination Locations. The operator can 
+iterate all DataSync Tasks for their source and destination LocationArns. Then it checks
+each LocationArn to see if its the URIs match the specified source / destination URI.
+Any and all DataSync Tasks that match are returned in a Python list.
+
+.. exampleinclude:: ../../../../../airflow/providers/amazon/aws/example_dags/example_datasync_simple.py
+    :language: python
+    :start-after: [START howto_operator_datasync_simple_args_2]
+    :end-before: [END howto_operator_datasync_simple_args_2]
+
+.. exampleinclude:: ../../../../../airflow/providers/amazon/aws/example_dags/example_datasync_simple.py
+    :language: python
+    :start-after: [START howto_operator_datasync_simple_2]
+    :end-before: [END howto_operator_datasync_simple_2]
+
+Note that there might not always be exactly one TaskArn in AWS and you may need additional
logic
+handle other cases (see example_datasync_complex).
 
 Review comment:
   That's not valid any more! But then a 'callable' example would be super useful here.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message