forked from blockchain-etl/ethereum-etl-airflow
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathethereum_load_dag.py
38 lines (33 loc) · 1.17 KB
/
ethereum_load_dag.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
from __future__ import print_function
import logging
from ethereumetl_airflow.build_load_dag import build_load_dag
from ethereumetl_airflow.build_load_dag_redshift import build_load_dag_redshift
from ethereumetl_airflow.variables import read_load_dag_vars
from ethereumetl_airflow.variables import read_load_dag_redshift_vars
from ethereumetl_airflow.variables import read_var
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
# Default is gcp
cloud_provider = read_var('cloud_provider', var_prefix=None, required=False, cloud_provider='gcp')
if cloud_provider == 'gcp':
# airflow DAG
DAG = build_load_dag(
dag_id='ethereum_load_dag',
chain='ethereum',
**read_load_dag_vars(
var_prefix='ethereum_',
schedule_interval='30 12 * * *'
)
)
elif cloud_provider == 'aws':
# airflow DAG
DAG = build_load_dag_redshift(
dag_id='ethereum_load_dag',
chain='ethereum',
**read_load_dag_redshift_vars(
var_prefix='ethereum_',
schedule_interval='30 1 * * *'
)
)
else:
raise ValueError('You must set a valid cloud_provider Airflow variable (gcp,aws)')