气流似乎正在跳过我添加到/ usr/local/airflow/dags的dags.
我跑的时候
airflow list_dags
Run Code Online (Sandbox Code Playgroud)
输出显示
[2017-08-06 17:03:47,220] {models.py:168} INFO - Filling up the DagBag from /usr/local/airflow/dags
-------------------------------------------------------------------
DAGS
-------------------------------------------------------------------
example_bash_operator
example_branch_dop_operator_v3
example_branch_operator
example_http_operator
example_passing_params_via_test_command
example_python_operator
example_short_circuit_operator
example_skip_dag
example_subdag_operator
example_subdag_operator.section-1
example_subdag_operator.section-2
example_trigger_controller_dag
example_trigger_target_dag
example_xcom
latest_only
latest_only_with_trigger
test_utils
tutorial
Run Code Online (Sandbox Code Playgroud)
但这不包括/ usr/local/airflow/dags中的dags
ls -la /usr/local/airflow/dags/
total 20
drwxr-xr-x 3 airflow airflow 4096 Aug 6 17:08 .
drwxr-xr-x 4 airflow airflow 4096 Aug 6 16:57 ..
-rw-r--r-- 1 airflow airflow 1645 Aug 6 17:03 custom_example_bash_operator.py
drwxr-xr-x 2 airflow airflow 4096 Aug 6 17:08 __pycache__
Run Code Online (Sandbox Code Playgroud)
气流是否需要满足其他条件来识别DAG并加载它?
Rup*_*sal 20
在列出dags之前尝试使用 airflow initdb.这是因为气流 list_dags列出了所有存在于数据库中(而不是你所提到的文件夹中)中的DAG.Airflow initdb将在数据库中为这些dag创建条目.
确保将环境变量AIRFLOW_HOME设置为/ usr/local/airflow.如果未设置此变量,气流将在主气流文件夹中查找dags,这可能不适用于您的情况.
Jer*_*ewi 15
我的dag正在加载,但我的DAG名称错了.我期望dag由文件命名,但名称由DAG构造函数的第一个参数决定
dag = DAG(
'tutorial', default_args=default_args, schedule_interval=timedelta(1))
Run Code Online (Sandbox Code Playgroud)
dag = DAG(
dag_id='example_bash_operator',
default_args=args,
schedule_interval='0 0 * * *',
dagrun_timeout=timedelta(minutes=60))
Run Code Online (Sandbox Code Playgroud)
实例化DAG时,它将以您在dag_id属性中指定的名称弹出。dag_id用作DAG的唯一标识符
示例文件不在/ usr / local / airflow / dags中。您可以通过编辑airflow.cfg(通常在〜/ airflow中)将其静音。集load_examples = False
在“核心”部分。
有几个错误可能会使您的DAG不在中列出list_dags
。
python custom_example_bash_operator.py
看看是否有问题。https://airflow.incubator.apache.org/tutorial.html
然后查看测试dag是否出现。dag = DAG('dag_name', default_args=default_args)
在dag文件中。小智 5
如果airflow.cfg 配置指向不正确的路径,就会出现这种情况。
第 1步:转到 {basepath}/src/config/
第 2 步:打开airflow.cfg
文件
第 3步:检查它应该指向您创建的 dags 文件夹的路径
dags_folder = /usr/local/airflow/dags
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
10812 次 |
最近记录: |