我正在尝试使用 SQS 将使用芹菜周期性任务的 django 项目部署到弹性 beantalk。
我或多或少地遵循了这里的说明:
如何使用 AWS Elastic Beanstalk 可扩展的 Django 应用程序运行 celery worker?
当我部署到 eb 时,没有执行周期性任务。
检查 celery-beat 日志,一切似乎都正确:
celery beat v4.2.1 (windowlicker) is starting.
__ - ... __ - _
LocalTime -> 2019-01-27 09:48:16
Configuration ->
. broker -> sqs://AKIAIVCNK32ABCHNNZSQ:**@localhost//
. loader -> celery.loaders.app.AppLoader
. scheduler -> django_celery_beat.schedulers.DatabaseScheduler
. logfile -> [stderr]@%INFO
. maxinterval -> 5.00 seconds (5s)
/opt/python/run/venv/local/lib64/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from …Run Code Online (Sandbox Code Playgroud) django amazon-web-services celery django-celery amazon-elastic-beanstalk
我在 AWS 中有一个运行 Python3.6 (Amazon Linux/2.8.3) 的 ec2 实例,我需要在其中安装 pycurl 和 NSS ssl backend。
pycurl==7.43.0 --global-option="--with-nss"首先,我通过添加到我的文件中进行尝试requirement.txt,但出现错误安装错误。因此,我最终通过添加一个.config文件.ebextensions(在部署期间运行)来完成此操作:
container_commands:
09_pycurl_reinstall:
# the upgrade option is because it will run after PIP installs the requirements.txt file.
# and it needs to be done with the virtual-env activated
command: 'source /opt/python/run/venv/bin/activate && PYCURL_SSL_LIBRARY=nss pip3 install pycurl --global-option="--with-nss" --upgrade --no-cache-dir --compile --ignore-installed'
Run Code Online (Sandbox Code Playgroud)
Pycurl 似乎已正确安装,但 celery 工作程序未运行。芹菜工人日志显示:
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file …Run Code Online (Sandbox Code Playgroud)