2

我正在尝试从气流的官方仓库运行这个新贵脚本: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进行测试,以防您需要自己查看。

4

2 回答 2

2

Upstart 在干净的环境中运行,这意味着它不会使用/etc/environment. 这意味着您必须AIRFLOW_HOME再次设置AIRFLOW_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
于 2016-06-27T21:10:50.927 回答
0

这是我在 Ubuntu 16 中所做的:(初始化脚本取自 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

(或任何其他气流服务)

祝你好运!

于 2017-04-20T14:07:31.327 回答