hightouch_trigger_sync

Data Processing


Providers:

Modules:

Last Updated: Jul. 6, 2021

Run this DAG

1. Install the Astronomer CLI:Skip if you already have the CLI

2. Initate the project in a local directory:

3. Copy and paste the code below into a file in the

dags
directory.

4. Add the following to your

requirements.txt
file:

5. Run the DAG from the local directory where the project was initiated:

from datetime import timedelta
from airflow import DAG
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.utils.dates import days_ago
from airflow_provider_hightouch.operators.hightouch import HightouchTriggerSyncOperator
from airflow_provider_hightouch.sensors.hightouch import HightouchMonitorSyncRunOperator
args = {"owner": "airflow"}
with DAG(
dag_id="example_hightouch_operator",
default_args=args,
schedule_interval="@daily",
start_date=days_ago(1),
dagrun_timeout=timedelta(minutes=5),
) as dag:
latest_only = LatestOnlyOperator(task_id="latest_only", dag=dag)
# This task runs async, and doesn't poll for status or fail on error
run_async = HightouchTriggerSyncOperator(task_id="run_async", sync_id=4)
# This tasks polls the API until the Hightouch Sync completes or errors.
# Warnings are considered errors, but this can be turned off with the
# specified flag
run_sync = HightouchTriggerSyncOperator(
task_id="run_sync", sync_id=5, synchronous=True, error_on_warning=True
)
sync_sensor = HightouchMonitorSyncRunOperator(
task_id="sync_sensor",
sync_run_id="123456",
sync_id="123")
latest_only >> sync_sensor
sync_sensor >> run_sync
sync_sensor >> run_async