zl程序教程

您现在的位置是:首页 >  后端

当前栏目

如何将CELERY放到后台执行?

后台执行 如何 放到 Celery
2023-09-27 14:28:45 时间

就是要注意supervisord.conf的目录存放位置。

放在DJANGO的PROJ目录下,是最佳位置。

 

 

https://thomassileo.name/blog/2012/08/20/how-to-keep-celery-running-with-supervisor/

如何你不幸的和我一样,无法PIP只能用setup.py的话,可能celery和supervisord都要用绝对目录

[program:celeryd]

command=/usr/local/python27/bin/celery worker --app=ism -c 4 -l info

stdout_logfile=/var/log/celeryd.log

stderr_logfile=/var/log/celeryd.log

autostart=true

autorestart=true

startsecs=10

stopwaitsecs=600

~~~~~~~~~~~~~~~~

How to keep Celery running with supervisor

Mon 20 August 2012 by Thomas Sileo


Supervisor is a Python program that allows you to control and keep running any unix processes. It can also restart crashed processes. I use it to make sure Celery workers are always running.

Im using virtualenv, Celery 3.0.5, and supervisor 3.0. Im assuming Celery is already installed and configured.

Installation

First, you need to install supervisor in your virtualenv and generate a configuration file.

I store a supervisord.conf config file at the root of each project, and also, be careful to use theabsolute path to the Python interpreter of the virtualenv.

$ pip install supervisor

$ cd /path/to/your/project

$ echo_supervisord_conf supervisord.conf

Next, just add this section after the [supervisord] section:

[program:celeryd]

command=/home/thomas/virtualenvs/yourvenv/bin/celery worker --app=myapp -l info 

stdout_logfile=/path/to/your/logs/celeryd.log

stderr_logfile=/path/to/your/logs/celeryd.log

autostart=true

autorestart=true

startsecs=10

stopwaitsecs=600

Its a simplified version of the Celery supervisor example configuration file, adapted to work with virtualenvs.

Usage

Just run supervisord in your project directory.

$ supervisord

Then, you can use the supervisorctl command to enter the interactive shell. Type help to get started. You can also execute supervisor command directly:

$ supervisorctl tail celeryd

$ supervisorctl restart celeryd

And you ?

If you have any tips or suggestions, dont hesitate !

~~~~~~~~~~~~~~~

 


python-windows命令行启动appium及杀掉对应接口进程 文章目录 windows命令行启动appium及杀掉对应接口进程 一.环境配置 1.安装命令行版appium 2.安装appium-doctor检测 3.python安装Appium-Python-Client: 4.定位uiautomatorviewer.bat 5.查看主包名主类名Activity 二.python-appium启动app 1.appium启动一加计算器相关参数: 2.windows查看端口 三.windows杀掉对应进程
Django配置celery(非djcelery)执行异步任务和定时任务 所有演示均基于Django2.0 celery是一个基于python开发的简单、灵活且可靠的分布式任务队列框架,支持使用任务队列的方式在分布式的机器/进程/线程上执行任务调度。采用典型的生产者-消费者模型,主要由三部分组成: 消息队列broker:broker实际上就是一个MQ队列服务,可以使...
ansible默认只会创建5个进程,所以一次任务只能同时控制5台机器执行.那如果你有大量的机器需要控制,或者你希望减少进程数,那你可以采取异步执行.ansible的模块可以把task放进后台,然后轮询它.