美文网首页
airflow python3 启动设置

airflow python3 启动设置

作者: Tofookie | 来源:发表于2017-08-31 15:22 被阅读0次

    之前一直用的python2版的airflow一直没毛病,很正常,今天把之前的

    所有调度任务迁移到python3版,尴尬了😓,不跑了,一直以为是schedule_interval的锅

    各种设置后 还是不行,开始怀疑人生,于是开始改start_date

    如果要想在schedule_interval设置的时间启动
    start_date设置为前一天,如果当期时间已超过schedule_interval会先运行一次

    default_args={
    
    'owner':'zz',
    
    'depends_on_past':False,
    
    'start_date':airflow.utils.dates.days_ago(1),
    
    }
    

    修改后开始跑了😆,看了下源码

    def days_ago(n, hour=0, minute=0, second=0, microsecond=0):
        """
        Get a datetime object representing `n` days ago. By default the time is
        set to midnight.
        """
        today = datetime.today().replace(
            hour=hour,
            minute=minute,
            second=second,
            microsecond=microsecond)
        return today - timedelta(days=n)
    

    相关文章

      网友评论

          本文标题:airflow python3 启动设置

          本文链接:https://www.haomeiwen.com/subject/rcmqjxtx.html