小编Ard*_*dan的帖子

气流trigger_dag execution_date是第二天,为什么?

最近我测试了气流这么多,execution_date在运行时有一个问题airflow trigger_dag <my-dag>.

我知道这execution_date不是我们第一次从这里想到的:

Airflow是作为ETL需求的解决方案而开发的.在ETL世界中,您通常会汇总数据.所以,如果我想总结2016-02-19的数据,我会在格林威治标准时间2016-02-20午夜进行,这将在2016-02-19的所有数据可用之后.

start_date = datetime.combine(datetime.today(),
                              datetime.min.time())

args = {
    "owner": "xigua",
    "start_date": start_date
}
dag = DAG(dag_id="hadoopprojects", default_args=args,
          schedule_interval=timedelta(days=1))


wait_5m = ops.TimeDeltaSensor(task_id="wait_5m",
                              dag=dag,
                              delta=timedelta(minutes=5))
Run Code Online (Sandbox Code Playgroud)

上面的代码是我日常工作流程的开始部分,第一个任务是TimeDeltaSensor在实际工作之前等待另外5分钟,所以这意味着我的dag将被触发2016-09-09T00:05:00,2016-09-10T00:05:00......等等.

在Web UI中,我可以看到类似的东西scheduled__2016-09-20T00:00:00,并且运行任务2016-09-21T00:00:00,根据ETL模型看似合理.

但是有一天我的dag不会因为未知原因被触发,所以我手动触发它,如果我触发它2016-09-20T00:10:00,那么TimeDeltaSensor将等到2016-09-21T00:15:00运行之前.

这不是我想要的,我希望它2016-09-20T00:15:00不是在第二天运行,我试过execution_date通过--conf '{"execution_date": "2016-09-20"}',但它不起作用.

我该如何处理这个问题?

$ airflow version
[2016-09-21 17:26:33,654] {__init__.py:36} INFO - Using executor LocalExecutor
  ____________       _____________
 ____    |__( )_________  __/__ …
Run Code Online (Sandbox Code Playgroud)

python airflow

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

airflow ×1

python ×1