나는 그걸로 찔러보고 잘하면이 코드로 작업 할 수 있습니다.
default_args = {
'owner': 'airflow',
'depends_on_past': False,
'start_date': datetime(2015, 6, 1),
'email': ['[email protected]'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
# 'queue': 'bash_queue',
# 'pool': 'backfill',
# 'priority_weight': 10,
# 'end_date': datetime(2016, 1, 1),
}
dag = DAG('your_dag', default_args=default_args)
#start of your tasks
first_task = BashOperator(task_id='print_date',
bash_command='python script1_name args',
dag=dag)
second_task = BashOperator(task_id='print_date',
bash_command='python script2_name args',
dag=dag)
third_task = BashOperator(task_id='print_date',
bash_command='python script_name args',
dag=dag)
#then set the dependencies
second_task.set_upstream(first_task)
third_task.set_upstream(second_task)
그런 다음 DAG를 트리거하면 세 가지 작업이 모두 실행됩니다. 이러한 작업이 이 아니고이 아닌 경우 스크립트에서 set_upstream()
줄을 제거 할 수 있습니다. 하나의 명령으로 실행하려면 이러한 모든 태스크가 동일한 스크립트에 있어야합니다.
공기 흐름 1.8에서
명확하게하기 위해 첫 번째 작업을 실행할 때 세 가지 작업을 모두 실행 하시겠습니까? 관련 코드를 게시하십시오. –
종속성을 설정 한 다음 'airflow trigger_dag id'명령 줄에서 dag를 실행하면 무엇이 문제입니까? –
네, 맞습니다. 우리는 첫 번째 작업을 실행할 때 모든 작업을 수행해야합니다. 제한 사항으로 인해 코드를 게시 할 수 없습니다. DAG를 통해 작업 흐름을 수동으로 트리거하는 팀을 지원할 것입니다. 명령 줄에 대한 경험이 많지 않으므로 UI를 통해 실행해야합니다. – user1432155