我刚到Airflow岁.我遵循一个教程,并编写了以下代码.

from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
from models.correctness_prediction import CorrectnessPrediction

default_args = {
    'owner': 'abc',
    'depends_on_past': False,
    'start_date': datetime.now(),
    'email': ['abc@xyz.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5)
}

def correctness_prediction(arg):
    CorrectnessPrediction.train()

dag = DAG('daily_processing', default_args=default_args)

task_1 = PythonOperator(
    task_id='print_the_context',
    provide_context=True,
    python_callable=correctness_prediction,
    dag=dag)

On running the script, it doesn't show any errors but when I check for dags in Web-UI it doesn't show under Menu->DAGs

enter image description here

But I can see the scheduled job under Menu->Browse->Jobs

enter image description here

我在$U HOME/dags中也看不到任何东西.难道只有这样吗?有人能解释为什么吗?

推荐答案

在jobs页面上看到的ScheduleJob是调度程序的一个条目.这不是计划中的dag.

奇怪的是,你的$HOME/DAG是空的.所有DAG必须位于$HOME/dags目录中(特别是在您的airflow.cfg文件中配置的DAG目录中).看起来您没有将实际的dag存储在正确的目录(dags目录)中.

或者,有时还需要重新启动Web服务器以显示dag(尽管这似乎不是问题所在).

Python-3.x相关问答推荐

如何获得给定列表中所有可能的元素组合?

Django 3.2/Django-cms 3.11:查找错误:型号帐户.客户用户未注册

当索引大于一个整数而小于前一个索引时,我如何返回列值?

在循环中使用Print&S结束参数时出现奇怪的问题

基于另一个数据帧计算总和

如何使用Selenium从网站下拉菜单中获取值列表?

一起使用数据类和枚举

Python base64.b32hexencode 未创建预期结果

以不规则频率识别数据框日期时间列上缺失的日期,并用关联值填充它们

Python defaultdict 在获取时返回 None,尽管使用默认值初始化

Generic[T] 基类 - 如何从实例中获取 T 的类型?

Python过滤器函数 - 单个结果

Python中的依赖倒置

我们如何获得 __repr__() 的默认行为?

在 Pandas 数据框中显示对图

pip install dryscrape 失败并显示错误:[Errno 2] 没有这样的文件或目录:'src/webkit_server'?

IronPython 3 支持?

python 3的蓝牙库

无论如何我可以在 Google colaboratory 中下载文件吗?

通过字典有效地替换Pandas 系列中的值