在命令行中测试 Airflow Dag

kee*_*kee 6 airflow

从https://airflow.apache.org/tutorial.html#testing上的 Airflow 手册中,我发现我可以运行如下所示的命令来测试特定任务:

airflow test dag_id task_id
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我只收到了这条消息:

[2018-07-10 18:29:54,346] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
[2018-07-10 18:29:54,367] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
[2018-07-10 18:29:54,477] {__init__.py:45} INFO - Using executor SequentialExecutor
[2018-07-10 18:29:54,513] {models.py:189} INFO - Filling up the DagBag from /var/lib/airflow/dags
Run Code Online (Sandbox Code Playgroud)

看起来它并没有真正运行它。我是不是误会了?或者还有另一种在本地运行 DAG 的方法吗?

tob*_*bi6 10

我从您链接到的页面中的段落复制了这个示例调用:

# command layout: command subcommand dag_id task_id date

# testing print_date
airflow test tutorial print_date 2015-06-01

# testing sleep
airflow test tutorial sleep 2015-06-01
Run Code Online (Sandbox Code Playgroud)

因此,只需包含如上所示的日期,DAG 任务就应该按预期运行。


小智 5

适用于气流版本 2.4.0

airflow tasks test tutorial sleep 2015-06-01
Run Code Online (Sandbox Code Playgroud)