-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s_sample.py
33 lines (27 loc) · 1.03 KB
/
k8s_sample.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
from airflow import DAG
from datetime import datetime, timedelta
from airflow.contrib.operators.kubernetes_pod_operator import KubernetesPodOperator
from airflow.operators.dummy_operator import DummyOperator
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime.utcnow(),
'email': ['airflow@example.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5)
}
dag = DAG(
'http_random_data', default_args=default_args, schedule_interval=timedelta(minutes=10))
start = DummyOperator(task_id='run_this_first', dag=dag)
passing = KubernetesPodOperator(namespace='raj-airflow',
image="tuskacad/fakerdata:0.3",
labels={"foo": "bar"},
name="random_http_data",
task_id="pod_task",
get_logs=False,
dag=dag,
in_cluster=True
)
passing.set_upstream(start)