forked from hex-inc/airflow-provider-hex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_hex.py
51 lines (43 loc) · 1.21 KB
/
example_hex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from datetime import timedelta
from typing import List
from airflow import DAG
from airflow.utils.dates import days_ago
from airflow_provider_hex.operators.hex import HexRunProjectOperator
from airflow_provider_hex.types import NotificationDetails
PROJ_ID = "391a12e6-8085-4781-bfed-e6cffc2c8346"
default_args = {
"owner": "airflow",
"depends_on_past": False,
"start_date": days_ago(1),
"email": ["[email protected]"],
"email_on_failure": False,
"email_on_retry": False,
"retries": 1,
"retry_delay": timedelta(minutes=5),
}
dag = DAG("hex", max_active_runs=1, default_args=default_args)
notifications: List[NotificationDetails] = [
{
"type": "SUCCESS",
"includeSuccessScreenshot": True,
"slackChannelIds": ["HEX666SQG"],
"userIds": [],
"groupIds": [],
}
]
sync_run = HexRunProjectOperator(
task_id="sync_run",
hex_conn_id="hex_default",
project_id=PROJ_ID,
dag=dag,
input_parameters={"myParam": 42},
notifications=notifications,
)
async_run = HexRunProjectOperator(
task_id="async_run",
hex_conn_id="hex_default",
project_id=PROJ_ID,
dag=dag,
synchronous=False,
input_parameters={"myParam": 42},
)