Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5d1b136
Initial commit
josh-fell Aug 14, 2021
ef3f493
Rename operator parameter name
josh-fell Aug 14, 2021
ac4c6bb
Small tweak to operator docstring
josh-fell Aug 16, 2021
ce3df7f
Create test_azure_data_factory.py
josh-fell Aug 19, 2021
7607d10
Changing operator parameter name
josh-fell Aug 27, 2021
36a7840
Trivial operator formatting changes
josh-fell Aug 27, 2021
40177ab
Change datatype of expected_statuses for sensor
josh-fell Aug 27, 2021
ee453d5
Removing expected_statuses from sensor
josh-fell Aug 27, 2021
a947055
Adding terminal statuses to ADF hook
josh-fell Aug 27, 2021
34641d9
Finalizing sensor unit test
josh-fell Aug 27, 2021
742aa9d
Removing Connection creation in sensor unit test
josh-fell Aug 27, 2021
39556e9
Rename create_pipeline_run parameter
josh-fell Aug 27, 2021
2af2134
Adding unit test for AzureDataFactoryRunPipelineOperator
josh-fell Aug 27, 2021
1a74100
Small update to ADF hook docstring
josh-fell Aug 28, 2021
b4a02fa
Small refactor of operator unit test
josh-fell Aug 28, 2021
5ce65da
Small updates to the operator, sensor, and example DAG
josh-fell Aug 28, 2021
a282433
Modifying custom conn field names
josh-fell Aug 28, 2021
7816d8c
Updating ADF connection doc
josh-fell Aug 28, 2021
942591a
Adding operator documentation
josh-fell Aug 28, 2021
5c5105c
Trivial update to example DAG
josh-fell Aug 28, 2021
51cc0c1
Adding how-to doc entry in provider.yaml
josh-fell Aug 28, 2021
2f37c55
AIP-21 + conn_id convention updates
josh-fell Aug 30, 2021
deccf38
Refactoring the check of a pipeline run status
josh-fell Aug 30, 2021
052ed37
Refactoring unit test + parameter rename
josh-fell Sep 2, 2021
15491d9
Parameter rename in hook
josh-fell Sep 2, 2021
e0e4173
Refactoring pipeline run status and waiting checks
josh-fell Sep 8, 2021
e5cdc2e
Adding hook deprecation messge to KNOWN_DEPRECATED_DIRECT_IMPORTS
josh-fell Sep 8, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 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.

from datetime import datetime, timedelta

from airflow.models import DAG
from airflow.operators.dummy import DummyOperator
from airflow.providers.microsoft.azure.operators.data_factory import AzureDataFactoryRunPipelineOperator
from airflow.providers.microsoft.azure.sensors.data_factory import AzureDataFactoryPipelineRunStatusSensor
from airflow.utils.edgemodifier import Label

with DAG(
dag_id="example_adf_run_pipeline",
start_date=datetime(2021, 8, 13),
schedule_interval="@daily",
catchup=False,
default_args={
"retries": 1,
"retry_delay": timedelta(minutes=3),
"azure_data_factory_conn_id": "azure_data_factory",
"factory_name": "my-data-factory", # This can also be specified in the ADF connection.
"resource_group_name": "my-resource-group", # This can also be specified in the ADF connection.
},
default_view="graph",
) as dag:
begin = DummyOperator(task_id="begin")
end = DummyOperator(task_id="end")

# [START howto_operator_adf_run_pipeline]
run_pipeline1 = AzureDataFactoryRunPipelineOperator(
task_id="run_pipeline1",
pipeline_name="pipeline1",
parameters={"myParam": "value"},
)
# [END howto_operator_adf_run_pipeline]

# [START howto_operator_adf_run_pipeline_async]
run_pipeline2 = AzureDataFactoryRunPipelineOperator(
task_id="run_pipeline2",
pipeline_name="pipeline2",
wait_for_termination=False,
)

pipeline_run_sensor = AzureDataFactoryPipelineRunStatusSensor(
task_id="pipeline_run_sensor",
run_id=run_pipeline2.output["run_id"],
)
# [END howto_operator_adf_run_pipeline_async]

begin >> Label("No async wait") >> run_pipeline1
begin >> Label("Do async wait with sensor") >> run_pipeline2
[run_pipeline1, pipeline_run_sensor] >> end

# Task dependency created via `XComArgs`:
# run_pipeline2 >> pipeline_run_sensor
Loading