气流新贵脚本在启动/运行状态

时间:2016-06-27 20:52:16

标签: ubuntu service upstart airflow

我正在尝试从官方回购中运行此新手脚本以获取气流:https://github.com/apache/incubator-airflow/blob/master/scripts/upstart/airflow-webserver.conf

start on started networking
stop on (deconfiguring-networking or runlevel [016])

respawn
respawn limit 5 30

setuid airflow
setgid airflow

exec usr/local/bin/airflow webserver

当我运行它时,这是输出:

$ sudo service airflow-webserver start
airflow-webserver start/running, process 7612

$ sudo service airflow-webserver status
airflow-webserver stop/waiting

但只是做exec /usr/local/bin/airflow webserver会完美地运行它而不会出现任何打嗝,这令人费解。有谁知道为什么会这样?

*您可以通过pip install airflow进行气流测试以防万一您需要自己查看。

2 个答案:

答案 0 :(得分:2)

Upstart在干净的环境中运行,这意味着它不会使用/etc/environment中的变量。这意味着您必须再次设置AIRFLOW_HOMEAIRFLOW_CONFIG

description "Airflow webserver daemon"

start on started networking
stop on (deconfiguring-networking or runlevel [016])

respawn
respawn limit 5 30

setuid airflow
setgid airflow

# I omitted all of the below because I assumed 
# it would pick it up from the already defined env
env AIRFLOW_CONFIG=/path/to/airflow/airflow.cfg
env AIRFLOW_HOME=/path/to/airflow
export AIRFLOW_CONFIG
export AIRFLOW_HOME

exec usr/local/bin/airflow webserver

答案 1 :(得分:0)

这是我在Ubuntu 16中所做的: (init脚本来自incubator-airflow git repo)

$ sudo cp incubator-airflow/scripts/systemd/*.service /etc/systemd/system/

在每个服务文件中,将用户和组行更改为所有者  目录,在我的情况下 - ubuntu并修改ExecStart:

User=ubuntu

Group=ubuntu

ExecStart=/usr/local/bin/airflow  webserver --pid $AIRFLOW_HOME/webserver.pid

请记住,ExecStart行在每个服务行中都有所不同。

然后:

$ sudo cp incubator-airflow/scripts/systemd/*.conf /etc/tmpfiles.d/
$ sudo mkdir /etc/sysconfig
$ sudo cp incubator-airflow/scripts/systemd/airflow /etc/sysconfig/airflow

将以下行添加到/ etc / sysconfig / airflow:

AIRFLOW_CONFIG=YOUR_airflow_home/airflow.cfg

AIRFLOW_HOME=YOUR_airflow_home

最后:

sudo systemctl daemon-reload
sudo systemctl start airflow-webserver

(或任何其他气流服务)

祝你好运!