【问题标题】:FileNotFoundError: [Errno 2] No such file or directory: 'hadoop'FileNotFoundError:[Errno 2] 没有这样的文件或目录:'hadoop'
【发布时间】:2021-09-30 18:28:01
【问题描述】:

我目前正在使用气流及其调度程序。我正在尝试使用 systemd 来正确管理 Web 服务器和调度程序这两个进程。但是,当使用 systemd(systemctl 命令)启动调度程序时,它在我的 dags 日志“FileNotFoundError:[Errno 2] 没有这样的文件或目录:'hadoop'”中出现此错误,如果我从命令行启动调度程序,一切正常(通过在终端中键入气流调度程序)。我想做的是使用 subprocess.Popen 来运行 Hadoop 命令。我只是想知道问题是什么。

这是我的 .service 文件

[Unit]
Description=Airflow scheduler daemon
After=network.target postgresql.service
Wants=postgresql.service

[Service]
EnvironmentFile=/root/.bashrc
User=root
Group=root
Type=simple
ExecStart=/bin/bash -c 'airflow scheduler'
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target

【问题讨论】:

    标签: python airflow systemd


    【解决方案1】:

    最可能的问题是您没有设置相同的变量。可能是你的PATH变量在运行时设置不正确。

    当您打开交互式 bash 会话时,通常会获取更多文件 - 很可能您的路径设置在 /etc/profile(但它可能位于其他地方)。

    https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

    【讨论】:

      【解决方案2】:

      这是一个环境变量问题。我通过重新导出气流运算符中的所有变量来解决。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-11-03
        • 2021-08-24
        • 2021-03-07
        • 2015-06-09
        • 2021-04-01
        • 2021-10-15
        • 1970-01-01
        相关资源
        最近更新 更多