从https://airflow.apache.org/tutorial.html#testing的Airflow手册中,我发现我可以执行以下操作来测试特定任务:
airflow test dag_id task_id
当我这样做的时候,我只收到以下消息:
[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
看起来好像不是真的在运行它。我误会了吗?还是有另一种在本地运行DAG的方法?
答案 0 :(得分:1)
我从您链接到的页面的段落中复制了此示例调用:
# 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
因此,只需包含如上所示的日期,DAG任务应按预期运行。