AirFlow笔记

阻止DAG回填:
catchup=False

设置最大并发数为1:
max_active_runs=1

schedule_interval 是任务时间设定,与Linux cron 时间不同
airflow cron 表达式: * * * * * * (分 时 月 年 周 秒)
dag_interval = “* * * * * */30” # 每30秒

dag_interval = "*/10 * * * *"  # 每10分钟

测试
airflow tasks test DAG_name task_name 2020-08-01

Pycharm调试DAG
修改~/airflow目录下的dags所在的目录
在这里插入图片描述
AirFlow开启webserver、scheduler、celery worker时要把Class().run()删除,不然会反复运行(差不多一两分钟运行一次)


# Airflow needs a home. `~/airflow` is the default, but you can put it
# somewhere else if you prefer (optional)
export AIRFLOW_HOME=~/airflow
#export AIRFLOW_HOME=/Users/wiliam/PycharmProjects/YouMi/ultraman/scheduler

# Install Airflow using the constraints file
AIRFLOW_VERSION=2.4.1
PYTHON_VERSION="$(python --version | cut -d " " -f 2 | cut -d "." -f 1-2)"
# For example: 3.7
CONSTRAINT_URL="https://raw.githubusercontent.com/apache/airflow/constraints-${AIRFLOW_VERSION}/constraints-${PYTHON_VERSION}.txt"
# For example: https://raw.githubusercontent.com/apache/airflow/constraints-2.4.1/constraints-3.7.txt
pip install "apache-airflow==${AIRFLOW_VERSION}" --constraint "${CONSTRAINT_URL}"

# The Standalone command will initialise the database, make a user,
# and start all components for you.
airflow standalone

# Visit localhost:8080 in the browser and use the admin account details
# shown on the terminal to login.
# Enable the example_bash_operator dag in the home page
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值