123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- from airflow import DAG
- from datetime import datetime
- from airflow.operators.bash import BashOperator
- from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator
- from airflow.configuration import conf
- namespace = conf.get("kubernetes", "NAMESPACE")
- # set the name that will be printed
- name = "dag_33"
- # instantiate the DAG
- with DAG(
- start_date=datetime(2022,6,1),
- catchup=False,
- schedule_interval='@daily',
- dag_id="auto_gen_test_job01"
- ) as dag:
-
- op_19 = KubernetesPodOperator(
- task_id="task_19_by_33",
- image="SXKJ:32775/pod_python:1.1",
- in_cluster=True,
- namespace=namespace,
- name="python_task_1664728952",
- random_name_suffix=True,
- labels={'app':'backend', 'env':'dev'},
- reattach_on_restart=True,
- is_delete_operator_pod=False,
- get_logs=True,
- log_events_on_failure=True,
- cmds=['/bin/bash', '-c', 'curl $FILE_TO_DOWNLOAD > run.py && python -b run.py '],
- env_vars={'SCRIPT': '', 'FILE_TO_DOWNLOAD': 'http://minio.default:9000/mytest/xxx/1664728951_hello_world.py'}
- )
-
- op_20 = KubernetesPodOperator(
- task_id="task_20_by_33",
- image="SXKJ:32775/pod_python:1.1",
- in_cluster=True,
- namespace=namespace,
- name="python_task_1664728953",
- random_name_suffix=True,
- labels={'app':'backend', 'env':'dev'},
- reattach_on_restart=True,
- is_delete_operator_pod=False,
- get_logs=True,
- log_events_on_failure=True,
- cmds=['/bin/bash', '-c', 'curl $FILE_TO_DOWNLOAD > run.py && python -b run.py '],
- env_vars={'SCRIPT': '', 'FILE_TO_DOWNLOAD': 'http://minio.default:9000/mytest/xxx/1664728953_hello_world.py'}
- )
-
- op_21 = KubernetesPodOperator(
- task_id="task_21_by_33",
- image="SXKJ:32775/pod_python:1.1",
- in_cluster=True,
- namespace=namespace,
- name="python_task_1664728954",
- random_name_suffix=True,
- labels={'app':'backend', 'env':'dev'},
- reattach_on_restart=True,
- is_delete_operator_pod=False,
- get_logs=True,
- log_events_on_failure=True,
- cmds=['/bin/bash', '-c', 'curl $FILE_TO_DOWNLOAD > run.py && python -b run.py '],
- env_vars={'SCRIPT': '', 'FILE_TO_DOWNLOAD': 'http://minio.default:9000/mytest/xxx/1664728954_hello_world.py'}
- )
-
- op_22 = KubernetesPodOperator(
- task_id="task_22_by_33",
- image="SXKJ:32775/pod_python:1.1",
- in_cluster=True,
- namespace=namespace,
- name="python_task_1664728975",
- random_name_suffix=True,
- labels={'app':'backend', 'env':'dev'},
- reattach_on_restart=True,
- is_delete_operator_pod=False,
- get_logs=True,
- log_events_on_failure=True,
- cmds=['/bin/bash', '-c', 'curl $FILE_TO_DOWNLOAD > run.py && python -b run.py '],
- env_vars={'SCRIPT': '', 'FILE_TO_DOWNLOAD': 'http://minio.default:9000/mytest/xxx/1664728975_hello_world.py'}
- )
-
- op_23 = KubernetesPodOperator(
- task_id="task_23_by_33",
- image="SXKJ:32775/pod_python:1.1",
- in_cluster=True,
- namespace=namespace,
- name="python_task_1664728976",
- random_name_suffix=True,
- labels={'app':'backend', 'env':'dev'},
- reattach_on_restart=True,
- is_delete_operator_pod=False,
- get_logs=True,
- log_events_on_failure=True,
- cmds=['/bin/bash', '-c', 'curl $FILE_TO_DOWNLOAD > run.py && python -b run.py '],
- env_vars={'SCRIPT': '', 'FILE_TO_DOWNLOAD': 'http://minio.default:9000/mytest/xxx/1664728976_hello_world.py'}
- )
-
-
- op_19 >> op_20
-
- op_20 >> op_21
-
- op_21 >> op_22
-
- op_22 >> op_23
-
|