Skip to content

Commit

Permalink
Migrate Google example gcs_to_gdrive to new design AIP-47 (#24949)
Browse files Browse the repository at this point in the history
related: #22447, #22430
  • Loading branch information
chenglongyan authored Jul 12, 2022
1 parent fb51e04 commit 626d9db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Copy single files

The following Operator would copy a single file.

.. exampleinclude:: /../../airflow/providers/google/suite/example_dags/example_gcs_to_gdrive.py
.. exampleinclude:: /../../tests/system/providers/google/cloud/gcs/example_gcs_to_gdrive.py
:language: python
:dedent: 4
:start-after: [START howto_operator_gcs_to_gdrive_copy_single_file]
Expand All @@ -58,7 +58,7 @@ Copy multiple files

The following Operator would copy all the multiples files (i.e. using wildcard).

.. exampleinclude:: /../../airflow/providers/google/suite/example_dags/example_gcs_to_gdrive.py
.. exampleinclude:: /../../tests/system/providers/google/cloud/gcs/example_gcs_to_gdrive.py
:language: python
:dedent: 4
:start-after: [START howto_operator_gcs_to_gdrive_copy_files]
Expand All @@ -70,7 +70,7 @@ Move files
Using the ``move_object`` parameter allows you to move the files. After copying the file to Google Drive,
the original file from the bucket is deleted.

.. exampleinclude:: /../../airflow/providers/google/suite/example_dags/example_gcs_to_gdrive.py
.. exampleinclude:: /../../tests/system/providers/google/cloud/gcs/example_gcs_to_gdrive.py
:language: python
:dedent: 4
:start-after: [START howto_operator_gcs_to_gdrive_move_files]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
from airflow import models
from airflow.providers.google.suite.transfers.gcs_to_gdrive import GCSToGoogleDriveOperator

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_gcs_to_gdrive"

GCS_TO_GDRIVE_BUCKET = os.environ.get("GCS_TO_DRIVE_BUCKET", "example-object")

with models.DAG(
"example_gcs_to_gdrive",
schedule_interval=None, # Override to match your needs,
DAG_ID,
schedule_interval="@once",
start_date=datetime(2021, 1, 1),
catchup=False,
tags=['example'],
tags=['example', 'gcs'],
) as dag:
# [START howto_operator_gcs_to_gdrive_copy_single_file]
copy_single_file = GCSToGoogleDriveOperator(
Expand All @@ -57,3 +60,9 @@
move_object=True,
)
# [END howto_operator_gcs_to_gdrive_move_files]


from tests.system.utils import get_test_run # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)

0 comments on commit 626d9db

Please sign in to comment.
  翻译: