from datetime import datetime, timedelta from textwrap import dedent import pendulum # The DAG object; we'll need this to instantiate a DAG from airflow import DAG local_tz = pendulum.timezone("Asia/Seoul") # Operators; we need this to operate! from airflow.operators.bash import BashOperator with DAG( 'batch_test', default_args={ 'depends_on_past': False, 'email': 'kim-jy@lotte.net', }, description='Test Batch Job', schedule_interval='*/1 * * * *', start_date=datetime(2022, 5, 13, tzinfo=local_tz), tags=['test'], catchup=False, ) as dag: # gasan 작업 병렬처리 post_gasan_tasks = [] for i in range(4): post_gasan_task = BashOperator( task_id='post_gasan'+str(i), bash_command="curl -X \'POST\' \'http://10.231.238.224:30999/api/v1/camera/writeimage\' -H \'Content-Type: application/json\' -d \'{\"id\": \"test%s\", \"pw\": \"test\", \"ip\": \"10.123.123.1\", \"serialNum\": \"aaaa\", \"camName\": \"abc\"}\'" %(str(i)), ) post_gasan_tasks.append(post_gasan_task) post_gasan_tasks # t1