0

我有许多 EC2 实例保留Celery作业进行处理。为了有效地启动完成队列的整体任务,我在 AWS 的SSM中使用调用 Python 脚本的 BASH 脚本测试了 AWS-RunBashScript。例如,对于单个实例,它以 . 开头sh start_celery.sh

当我在 SSM 中运行命令时,这是以下输出(与下面的其他输出相比,阅读后):

/home/ec2-user/dh2o-py/venv/local/lib/python2.7/dist-packages/celery/utils/imports.py:167: 
UserWarning: Cannot load celery.commands extension u'flower.command:FlowerCommand': 
ImportError('No module named compat',)
  namespace, class_name, exc))

/home/ec2-user/dh2o-py/tasks/task_harness.py:49: YAMLLoadWarning: calling yaml.load() without 
Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  task_configs = yaml.load(conf)

Running a worker with superuser privileges when the worker accepts messages serialized with pickle is a very bad idea!

If you really want to continue then you have to set the C_FORCE_ROOT
environment variable (but please think about this before you do).

User information: uid=0 euid=0 gid=0 egid=0

failed to run commands: exit status 1

请注意,仅会引发警告。当我 SSH 到同一个实例并运行相同的命令(即sh start_celery.sh)时,以下(相同)输出结果进程运行:

在此处输入图像描述

我已经验证通过 SSM 执行此操作时该过程不会运行,我不知道为什么。作为一种解决方法,我尝试sh start_celery.sh在每个 EC2 的用户数据中引导运行该命令,但这也失败了。

那么,为什么 SSM 无法实际运行我通过 SSH 实际通过运行相同命令的每个实例成功执行的过程?以下详细信息与机器和 Python 配置有关:

在此处输入图像描述 在此处输入图像描述

4

0 回答 0