|
| 1 | +# Copyright 2021 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +from airflow import DAG |
| 17 | +from airflow.providers.google.cloud.transfers import gcs_to_gcs |
| 18 | + |
| 19 | +default_args = { |
| 20 | + "owner": "Google", |
| 21 | + "depends_on_past": False, |
| 22 | + "start_date": "2022-07-20", |
| 23 | +} |
| 24 | + |
| 25 | + |
| 26 | +with DAG( |
| 27 | + dag_id="celeba.celeba", |
| 28 | + default_args=default_args, |
| 29 | + max_active_runs=1, |
| 30 | + schedule_interval="@once", |
| 31 | + catchup=False, |
| 32 | + default_view="graph", |
| 33 | +) as dag: |
| 34 | + |
| 35 | + # Transfer data from source to destination in GCS |
| 36 | + GCStoGCS_transfer = gcs_to_gcs.GCSToGCSOperator( |
| 37 | + task_id="GCStoGCS_transfer", |
| 38 | + source_bucket="{{ var.json.celeba.source_bucket }}", |
| 39 | + source_object="{{ var.json.celeba.source_object }}", |
| 40 | + destination_bucket="{{ var.json.celeba.destination_bucket }}", |
| 41 | + destination_object="{{ var.json.celeba.destination_object }}", |
| 42 | + ) |
| 43 | + |
| 44 | + GCStoGCS_transfer |
0 commit comments