-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdag_using_taskflow.py
More file actions
53 lines (36 loc) · 985 Bytes
/
dag_using_taskflow.py
File metadata and controls
53 lines (36 loc) · 985 Bytes
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
from airflow import DAG
from datetime import datetime
# from airflow.operators.python_operator import PythonOperator
from airflow.decorators import task,dag
# Define default arguments
default_args = {
'owner': 'bibek',
'start_date': datetime(2024, 2, 28),
'retries': 1,
}
# Instantiate your DAG
@dag('dag_with_taskflow', default_args=default_args,
tags=['python','dependencies','taskflow_api'], schedule_interval=None)
def dag_with_taskflow_api():
# Define tasks
@task
def func1():
print("Executing Task 1")
@task
def func2():
print("Executing Task 2")
@task
def func3():
print("Executing Task 3")
@task
def func4():
print("Executing Task 4")
@task
def func5():
print("Executing Task 5")
@task
def func6():
print("Executing Task 6")
# Set task dependencies
func1() >> func2() >> [func3(), func4(), func5()] >> func6()
dag_with_taskflow_api()