Airflow 你好,Apache的世界不工作
我正在学习ApacheAirflow并尝试编写HelloWorld版本 我已经用python版本3.8安装了apache airflow版本2.0,下面是包含dag和task的代码Airflow 你好,Apache的世界不工作,airflow,Airflow,我正在学习ApacheAirflow并尝试编写HelloWorld版本 我已经用python版本3.8安装了apache airflow版本2.0,下面是包含dag和task的代码 import datetime import logging from airflow import DAG from airflow.operators.python import PythonOperator def greet_hello(): logging.info("Hello W
import datetime
import logging
from airflow import DAG
from airflow.operators.python import PythonOperator
def greet_hello():
logging.info("Hello World")
dag = DAG("FirstDag", start_date=datetime.datetime.now(),schedule_interval=None)
first_task = PythonOperator(python_callable=greet_hello , dag=dag , task_id="first-task")
我以以下方式配置了apache airflow
当我转到“图形视图”并将鼠标悬停在第一个任务上时,它会显示“尚未启动”。我正在努力找出我到底出了什么错,以及如何解决它。谢谢我认为这里有两个问题
活动
,以便安排任务
scheduler\u heartbeat\u sec
scheduler\u health\u check\u threshold
,您将看到指示的消息。这并不意味着任何东西都坏了,只是意味着不确定调度程序是否处于活动状态
http://localhost:8080/health
(或本地使用的任何端口)。不要担心状态
值,因为它是用与心跳
和心率
相同的逻辑生成的。但是latest\u scheduler\u heartbeat
将告诉您调度器最近什么时候有心跳
切勿将
datetime.datetime.now()用作开始日期
。请阅读以了解原因
开始日期应尽可能保持静态
其次,正如James所建议的,确保unpause
DAG来自Web服务器,或者在创建DAG对象时将设置为True
,检查调度程序的运行状况…显示运行状况良好,并且在调度程序的日志中没有错误。是否执行其他步骤,包括确保DAG处于活动状态?停止并重新启动您的计划程序也不会有什么坏处。我能够按照您提到的步骤解决问题。非常感谢
$ airflow config get-value scheduler scheduler_health_check_threshold
30
$ airflow config get-value scheduler scheduler_heartbeat_sec
5