气流TimeDeltaSensor因操作数类型不受支持而失败 [英] airflow TimeDeltaSensor fails with unsupported operand type

查看:187
本文介绍了气流TimeDeltaSensor因操作数类型不受支持而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的DAG中,我有一个



气流版本为1.8.1。



代码是基本的从管道定义示例因此我对可能的问题一无所知。有任何想法吗?

解决方案

在链接的源代码中,有一行对我来说很有趣:

  target_dttm = dag.following_schedule(context ['execution_date'])

这意味着:如果您没有设置正确的DAG时间表,则此组件将尝试将其时间增量添加到 None



我不确定问题中的代码仅仅是示例还是整个问题。我的建议是:添加一个DAG时间表,而不是 None


In my DAG I have a TimeDeltaSensor created using:

from datetime import datetime, timedelta
from airflow.operators.sensors import TimeDeltaSensor 
wait = TimeDeltaSensor(
    task_id='wait',
    delta=timedelta(seconds=300),
    dag=dag
)

However when it runs I get error

  • Subtask: [2018-07-13 09:00:39,663] {models.py:1427} ERROR - unsupported operand type(s) for +=: 'NoneType' and 'datetime.timedelta'

Airflow version is 1.8.1.

The code is basically lifted from Example Pipeline definition so I'm nonplussed as to what the problem could be. Any ideas?

解决方案

Looking into the source code you linked there is one line that strikes me as interesting in this case:

target_dttm = dag.following_schedule(context['execution_date'])

Which means: If you don't have setup a proper DAG schedule this component will try to add its time delta to None.

I am not sure if the code in the question is just an example or the whole thing. My suggestion is: Add a DAG schedule with is other than None.

这篇关于气流TimeDeltaSensor因操作数类型不受支持而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆