DAG: booking-by-hour-model-transform_v002

schedule: 30 1 * * *


booking-by-hour-model-transform_v002

Toggle wrap
 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
from airflow import DAG
from airflow.utils.dates import days_ago
from template.dag_template import build_dag

dag_id = 'booking-by-hour-model-transform_v002'

emr_steps = """[
    {
       "step-name": "BookingByHour-ModelTransform",
        "config-json": [
          {"spark.driver.memory":"20g"}
        ],
        "main-class": "com.viooh.transform.BookingModelTransform",
        "group-id": "uk/co/viooh",
        "artifact": "pandora-model-transform",
        "files": "s3://viooh-spark-artifacts-lab-cn/metrics/batch-job-metrics/0.0.0/job.conf,s3://viooh-spark-artifacts-lab-cn/metrics/batch-job-metrics/0.0.0/job.yaml"
    }
]"""

# cluster level parameters (optional)
cluster_args = {
    "master-instance-types": "m5.xlarge,m5.4xlarge",
    "core-instance-types": "m5.2xlarge,m5.4xlarge",
    "task-instance-types": "m5.2xlarge,m5.4xlarge",
    "core-instance-capacity": 5,
    "task-instance-capacity": 0,
    "ebs-volume-size": "50",
    "emr-version": "emr-6.14.0"

}

# dag parameter
dag_args = {
    'owner': 'data.engineers@viooh.com',
    'start_date': days_ago(1)
}

dag = DAG(
    dag_id,
    schedule_interval="30 1 * * *",  # cron expression - every day 1:30 AM
    default_args=dag_args)

build_dag(emr_steps=emr_steps, dag=dag, cluster_args=cluster_args)