File tree Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Expand file tree Collapse file tree 2 files changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ apiVersion : batch/v1
2
+ kind : Job
3
+ metadata : {}
4
+ spec :
5
+ template :
6
+ spec :
7
+ restartPolicy : Never
8
+ containers :
9
+ - name : job-executor
10
+ image : ubuntu
11
+ command :
12
+ - bash
13
+ - -c
14
+ - |
15
+ #/bin/bash
16
+ echo "Fast print in $SLEEP_INTERVAL seconds"
17
+ sleep $SLEEP_INTERVAL
18
+ for i in "$(seq 1 $LINE_COUNT)"; do
19
+ echo "$i"
20
+ done
21
+ sleep $SLEEP_INTERVAL
22
+ echo "Done"
23
+ env :
24
+ - name : LINE_COUNT
25
+ value : ' 10000'
26
+
27
+ - name : SLEEP_INTERVAL
28
+ value : ' 5'
29
+ backoffLimit : 0
Original file line number Diff line number Diff line change
1
+ from utils import default_args , name_from_file
2
+ from airflow import DAG
3
+ from airflow_kubernetes_job_operator .kubernetes_job_operator import (
4
+ KubernetesJobOperator ,
5
+ )
6
+
7
+ dag = DAG (
8
+ name_from_file (__file__ ),
9
+ default_args = default_args ,
10
+ description = "Test base job operator" ,
11
+ schedule_interval = None ,
12
+ catchup = False ,
13
+ )
14
+
15
+ namespace = None
16
+
17
+ envs = {
18
+ "PASS_ARG" : "a test" ,
19
+ "JINJA_ENV" : "{{ ds }}" ,
20
+ }
21
+
22
+ default_delete_policy = "IfSucceeded"
23
+
24
+ # Job
25
+ KubernetesJobOperator (
26
+ task_id = "test-pod-success" ,
27
+ namespace = namespace ,
28
+ body_filepath = "./templates/test_job.fast_log.yaml" ,
29
+ envs = envs ,
30
+ dag = dag ,
31
+ delete_policy = default_delete_policy ,
32
+ )
33
+
34
+ if __name__ == "__main__" :
35
+ from tests .test_utils import test_dag
36
+
37
+ test_dag (dag )
You can’t perform that action at this time.
0 commit comments