我对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)
在运行脚本时,没有显示任何错误,但是当我在Web-UI中检查
dags
时,它没有出现在菜单->DAGs下。
但是我可以在“菜单”->“浏览”->“作业”下看到已安排的任务
。
我也无法在$AIRFLOW_HOME/dags中看到任何内容。这是正常的吗?有人可以解释一下吗?
dags
的子目录,并将您的 DAG 移动到该目录中。然后刷新 Airflow UI,您应该能够看到它。请注意,AIRFLOW_HOME
应设置为您的主项目目录。 - tsveti_iko