hightouch_trigger_sync
Data Processing
Providers:
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 thedags
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 timedeltafrom airflow import DAGfrom airflow.operators.latest_only import LatestOnlyOperatorfrom airflow.utils.dates import days_agofrom airflow_provider_hightouch.operators.hightouch import HightouchTriggerSyncOperatorfrom airflow_provider_hightouch.sensors.hightouch import HightouchMonitorSyncRunOperatorargs = {"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 errorrun_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 flagrun_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_sensorsync_sensor >> run_syncsync_sensor >> run_async