celery.bin.multi
Examples
# Single worker with explicit name and events enabled.
$ celery multi start Leslie -E
# Pidfiles and logfiles are stored in the current directory
# by default. Use --pidfile and --logfile argument to change
# this. The abbreviation %N will be expanded to the current
# node name.
$ celery multi start Leslie -E --pidfile=/var/run/celery/%N.pid
--logfile=/var/log/celery/%N.log
# You need to add the same arguments when you restart,
# as these are not persisted anywhere.
$ celery multi restart Leslie -E --pidfile=/var/run/celery/%N.pid
--logfile=/var/run/celery/%N.log
# To stop the node, you need to specify the same pidfile.
$ celery multi stop Leslie --pidfile=/var/run/celery/%N.pid
# 3 workers, with 3 processes each
$ celery multi start 3 -c 3
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# start 3 named workers
$ celery multi start image video data -c 3
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# specify custom hostname
$ celery multi start 2 --hostname=worker.example.com -c 3
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# specify fully qualified nodenames
$ celery multi start [email protected] [email protected] -c 3
# Advanced example starting 10 workers in the background:
# * Three of the workers processes the images and video queue
# * Two of the workers processes the data queue with loglevel DEBUG
# * the rest processes the default' queue.
$ celery multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
-Q default -L:4,5 DEBUG
# You can show the commands necessary to start the workers with
# the 'show' command:
$ celery multi show 10 -l INFO -Q:1-3 images,video -Q:4,5 data
-Q default -L:4,5 DEBUG
# Additional options are added to each celery worker' comamnd,
# but you can also modify the options for ranges of, or specific workers
# 3 workers: Two with 3 processes, and one with 10 processes.
$ celery multi start 3 -c 3 -c:1 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# can also specify options for named workers
$ celery multi start image video data -c 3 -c:image 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# ranges and lists of workers in options is also allowed:
# (-c:1-3 can also be written as -c:1,2,3)
$ celery multi start 5 -c 3 -c:1-3 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 3
celery worker -n [email protected] -c 3
# lists also works with named workers
$ celery multi start foo bar baz xuzzy -c 3 -c:foo,bar,baz 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 10
celery worker -n [email protected] -c 3
class celery.bin.multi.MultiTool(env=None, fh=None, quiet=False, verbose=False, no_color=False, nosplash=False)[源代码]
DOWN None[源代码]
FAILED None[源代码]
OK None[源代码]
colored None[源代码]
error(msg=None)[源代码]
execute_from_commandline(argv, cmd=u’celery worker’)[源代码]
expand(argv, cmd=None)[源代码]
get(argv, cmd)[源代码]
getpids(p, cmd, callback=None)[源代码]
help(argv, cmd=None)[源代码]
info(msg, newline=True)[源代码]
kill(argv, cmd)[源代码]
names(argv, cmd)[源代码]
node_alive(pid)[源代码]
note(msg, newline=True)[源代码]
restart(argv, cmd)[源代码]
retcode = 0
say(m, newline=True)[源代码]
show(argv, cmd)[源代码]
shutdown_nodes(nodes, sig=15, retry=None, callback=None)[源代码]
signal_node(nodename, pid, sig)[源代码]
splash()[源代码]
start(argv, cmd)[源代码]
stop(argv, cmd, retry=None, callback=None)[源代码]
stop_verify(argv, cmd)
stopwait(argv, cmd)[源代码]
usage()[源代码]
waitexec(argv, path=’/usr/bin/python’)[源代码]
with_detacher_default_options(p)[源代码]