celery使用详细

安装过程就不说了。。。

先配置rabbitmq

Setting up RabbitMQ
To use celery we need to create a RabbitMQ user, a virtual host and allow that user access to that virtual host:

$ rabbitmqctl add_user myuser mypassword

$ rabbitmqctl add_vhost myvhost

$ rabbitmqctl set_permissions -p myvhost myuser ".*" ".*" ".*"


创建消息队列执行的服务器,用户名等等。。。


celeryd 参数 配置


-c, --concurrency
Number of child processes processing the queue. The default is the number of CPUs available on your system.

-f, --logfile
Path to log file. If no logfile is specified, stderr is used.

-l, --loglevel
Logging level, choose between DEBUG, INFO, WARNING, ERROR, CRITICAL, or FATAL.

-n, --hostname
Set custom hostname.

-B, --beat
Also run the celerybeat periodic task scheduler. Please note that there must only be one instance of this service.

-Q, --queues
List of queues to enable for this worker, separated by comma. By default all configured queues are enabled. Example: -Q video,image

-I, --include
Comma separated list of additional modules to import. Example: -I foo.tasks,bar.tasks

-s, --schedule
Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule. The extension ”.db” will be appended to the filename.

--scheduler
Scheduler class to use. Default is celery.beat.PersistentScheduler

-E, --events
Send events that can be captured by monitors like celerymon.

--purge, --discard
Discard all waiting tasks before the daemon is started. WARNING: This is unrecoverable, and the tasks will be deleted from the messaging server.

--time-limit
Enables a hard time limit (in seconds) for tasks.

--soft-time-limit
Enables a soft time limit (in seconds) for tasks.

--maxtasksperchild
Maximum number of tasks a pool worker can execute before it’s terminated and replaced by a new worker.

class celery.bin.celeryd.WorkerCommand(app=None, get_app=None)
enable_config_from_cmdline = True
get_options()
namespace = 'celeryd'
run(*args, **kwargs)
supports_args = False
celery.bin.celeryd.main()


window下使用名令
环境变量设置
C:\Python27\Scripts

启动celery命令
python -m celery.bin.celeryd --loglevel=DEBUG

环境变量设置
D:\Program Files\RabbitMQ Server\rabbitmq_server-2.7.1\sbin
文章开头的命令

rabbitmqctl 打印帮助信息
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值