【发布时间】:2018-02-09 12:51:00
【问题描述】:
我正在使用 Apache Airflow 来安排作为 Python 脚本的 ETL 作业。 当我在气流上创建 dags 时,它会将 dags 状态设置为关闭。我的代码是这样的。
import airflow
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'oguz',
'depends_on_past': False,
'start_date': datetime(2018, 1, 25),
'email': ['airflow@airflow.com'],
'email_on_failure': False,
'email_on_retry': False,
'retries': 1,
'retry_delay': timedelta(minutes=5),
'end_date': datetime(9999, 1, 1),
}
dag = DAG('%s', default_args=default_args, schedule_interval='@daily')
# t1 and t2 are examples of tasks created by instantiating operators
t1 = BashOperator(
task_id='%s',
bash_command='python /bookmark/ETL/extract/incremental/%s.py',
dag=dag)
t2 = BashOperator(
task_id='%s',
bash_command='python /bookmark/ETL/load/incremental/%s.py',
retries=3,
dag=dag)
t2.set_upstream(t1)
我搜索了气流文档,但找不到任何东西。
如何自动运行气流 dags?
谢谢,
【问题讨论】:
标签: python airflow etl directed-acyclic-graphs