-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdag.py
More file actions
36 lines (32 loc) · 1.13 KB
/
Copy pathdag.py
File metadata and controls
36 lines (32 loc) · 1.13 KB
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
from datetime import datetime, timedelta
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from airflow.utils.dates import days_ago
from airflow.providers.google.cloud.operators.datafusion import CloudDataFusionStartPipelineOperator
default_args = {
'owner': 'airflow',
'start_date': datetime(2023, 12, 18),
'depends_on_past': False,
'email': ['vishal.bulbule@techtrapture.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
}
dag = DAG('employee_data',
default_args=default_args,
description='Runs an external Python script',
schedule_interval='@daily',
catchup=False)
with dag:
run_script_task = BashOperator(
task_id='extract_data',
bash_command='python /home/airflow/gcs/dags/scripts/extract.py',
)
start_pipeline = CloudDataFusionStartPipelineOperator(
location="us-central1",
pipeline_name="ETL_employee_information_pipeline",
instance_name="datafusion-dev",
task_id="start_datafusion_pipeline",
)
run_script_task >> start_pipeline