我有一个EC2实例,它运行airflow 1.8.0,使用
LocalExecutor
. 根据这些文档,我预计以下两个命令之一会在守护进程模式下启动调度程序:
airflow scheduler --daemon --num_runs=20
或
airflow scheduler --daemon=True --num_runs=5
但事实并非如此。第一个命令似乎可以工作,但在返回到终端之前,它只返回以下输出,而不生成任何后台任务:
[2017-09-28 18:15:02,794] {__init__.py:57} INFO - Using executor LocalExecutor
[2017-09-28 18:15:03,064] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python3.5/lib2to3/Grammar.txt
[2017-09-28 18:15:03,203] {driver.py:120} INFO - Generating grammar tables from /usr/lib/python3.5/lib2to3/PatternGrammar.txt
airflow scheduler: error: argument -D/--daemon: ignored explicit argument 'True'
这很奇怪,因为根据
docs
--daemon=True
应该是
airflow scheduler
挖得再深一点我就知道了
this StackOverflow post
,其中一个回复建议实施
systemd
用于根据以下可用代码将气流调度器作为后台进程进行处理:
this repo
我对剧本稍加修改后的版本发布如下。我用的是香草m4。使用Ubuntu 16.04.3的xlarge EC2实例:
sudo systemctl enable airflow-scheduler
sudo systemctl start airflow-scheduler
什么都没发生。虽然我在这个实例上运行了更复杂的DAG,
I am using this dummy case
创建一个简单的测试,它也可以作为侦听器,让我知道调度程序何时按计划运行。
我一直在使用
journalctl -f
调试。下面是调度程序进程的几行输出。没有明显的问题,但我的任务没有执行,没有为测试DAG生成日志,这将帮助我放大错误。这里有什么问题吗?
Sep 28 18:39:30 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:30,965] {dag_processing.py:627} INFO - Started a process (PID: 21822) to generate tasks for /home/ubuntu/airflow/dags/scheduler_test_dag.py - logging into /home/ubuntu/airflow/logs/scheduler/2017-09-28/scheduler_test_dag.py.log
Sep 28 18:39:31 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:31,016] {jobs.py:1002} INFO - No tasks to send to the executor
Sep 28 18:39:31 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:31,020] {jobs.py:1440} INFO - Heartbeating the executor
Sep 28 18:39:32 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:32,022] {jobs.py:1404} INFO - Heartbeating the process manager
Sep 28 18:39:32 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:32,023] {jobs.py:1440} INFO - Heartbeating the executor
Sep 28 18:39:33 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:33,024] {jobs.py:1404} INFO - Heartbeating the process manager
Sep 28 18:39:33 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:33,025] {dag_processing.py:559} INFO - Processor for /home/ubuntu/airflow/dags/capone_dash_dag.py finished
Sep 28 18:39:33 ip-172-31-15-209 airflow[20603]: [2017-09-28 18:39:33,026] {dag_processing.py:559} INFO - Processor for /home/ubuntu/airflow/dags/scheduler_test_dag.py finished
气流调度器
手动操作一切正常。因为我的测试DAG的开始日期是9月9日,所以从那时起它每分钟都在回填,生成一个运行时间计时器。当我使用
系统D
有什么想法吗?