当前位置:首页 > 开发 > 编程语言 > 编程 > 正文

celery使用详细

发表于: 2012-06-14   作者:cooler1217   来源:转载   浏览:
EL
摘要: 安装过程就不说了。。。 先配置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 myus
安装过程就不说了。。。

先配置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 打印帮助信息

celery使用详细

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号