gpt4 book ai didi

python - 如何在OpenShift上运行各种worker?

转载 作者:太空宇宙 更新时间:2023-11-03 16:46:08 24 4
gpt4 key购买 nike

我有一个 Python/Flask 项目 (API),其中包含一些必须连续运行的工作线程。他们使用外部提供商 ( https://redislabs.com/ ) 连接到 Redis。我没有找到如何配置 Openshift 来运行我的工作人员。使用 Heroku 时,非常简单:

web: gunicorn wsgi --log-file -
postsearch: python manage.py worker --queue post-search
statuses: python manage.py worker --queue statuses
message: python manage.py worker --queue message
invoice: python manage.py worker --queue invoice

但是对于 Openshift,尽管谷歌搜索了很多东西,但我找不到任何可以帮助我的东西。理想情况下,我会避免将应用程序部署到每个齿轮。如何使用 OpenShift 运行多个工作程序?

最佳答案

摘自Katie J. Miller 和 Steven Pousty 的《Openshift 入门》

Cartridge

To get a gear to do anything, you need to add a cartridge. Cartridges are the plugins that house the framework or components that can be used to create and run an application. One or more cartridges run on each gear, and the same cartridge can run on many gears for clustering or scaling. There are two kind of cartridges:

Standalone

These are the languages or application server that are set up to serve your web content, such as JBoss, Tomcat, Python, or Node.js. Having one of these cartridges is sufficient to run an application.

Embedded An embedded cartridge provides functionality to enhance your application, such as database or Cron, but cannot be used on its own to create and application.

TL;DR:您必须使用盒式磁带来运行工作进程。该文档可以找到herehere ,以及社区维护的示例 here一系列博文开始here

卡带是一堆文件和 list ,让操作系统知道如何运行卡带以及如何解析依赖项。

但是让我们构建一些东西吧。创建一个Django/Python应用程序,结果是:

the demo django app

现在从底部的链接或命令行工具安装您的(自定义)盒式磁带,您可以使用盒式磁带存储库的链接。

关于python - 如何在OpenShift上运行各种worker?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36286135/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com