celery.bin.multi

Examples

  1. # Single worker with explicit name and events enabled.
  2. $ celery multi start Leslie -E
  3. # Pidfiles and logfiles are stored in the current directory
  4. # by default. Use --pidfile and --logfile argument to change
  5. # this. The abbreviation %N will be expanded to the current
  6. # node name.
  7. $ celery multi start Leslie -E --pidfile=/var/run/celery/%N.pid
  8. --logfile=/var/log/celery/%N.log
  9. # You need to add the same arguments when you restart,
  10. # as these are not persisted anywhere.
  11. $ celery multi restart Leslie -E --pidfile=/var/run/celery/%N.pid
  12. --logfile=/var/run/celery/%N.log
  13. # To stop the node, you need to specify the same pidfile.
  14. $ celery multi stop Leslie --pidfile=/var/run/celery/%N.pid
  15. # 3 workers, with 3 processes each
  16. $ celery multi start 3 -c 3
  17. celery worker -n [email protected] -c 3
  18. celery worker -n [email protected] -c 3
  19. celery worker -n [email protected] -c 3
  20. # start 3 named workers
  21. $ celery multi start image video data -c 3
  22. celery worker -n [email protected] -c 3
  23. celery worker -n [email protected] -c 3
  24. celery worker -n [email protected] -c 3
  25. # specify custom hostname
  26. $ celery multi start 2 --hostname=worker.example.com -c 3
  27. celery worker -n [email protected] -c 3
  28. celery worker -n [email protected] -c 3
  29. # specify fully qualified nodenames
  30. $ celery multi start [email protected] [email protected] -c 3
  31. # Advanced example starting 10 workers in the background:
  32. # * Three of the workers processes the images and video queue
  33. # * Two of the workers processes the data queue with loglevel DEBUG
  34. # * the rest processes the default' queue.
  35. $ celery multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
  36. -Q default -L:4,5 DEBUG
  37. # You can show the commands necessary to start the workers with
  38. # the 'show' command:
  39. $ celery multi show 10 -l INFO -Q:1-3 images,video -Q:4,5 data
  40. -Q default -L:4,5 DEBUG
  41. # Additional options are added to each celery worker' comamnd,
  42. # but you can also modify the options for ranges of, or specific workers
  43. # 3 workers: Two with 3 processes, and one with 10 processes.
  44. $ celery multi start 3 -c 3 -c:1 10
  45. celery worker -n [email protected] -c 10
  46. celery worker -n [email protected] -c 3
  47. celery worker -n [email protected] -c 3
  48. # can also specify options for named workers
  49. $ celery multi start image video data -c 3 -c:image 10
  50. celery worker -n [email protected] -c 10
  51. celery worker -n [email protected] -c 3
  52. celery worker -n [email protected] -c 3
  53. # ranges and lists of workers in options is also allowed:
  54. # (-c:1-3 can also be written as -c:1,2,3)
  55. $ celery multi start 5 -c 3 -c:1-3 10
  56. celery worker -n [email protected] -c 10
  57. celery worker -n [email protected] -c 10
  58. celery worker -n [email protected] -c 10
  59. celery worker -n [email protected] -c 3
  60. celery worker -n [email protected] -c 3
  61. # lists also works with named workers
  62. $ celery multi start foo bar baz xuzzy -c 3 -c:foo,bar,baz 10
  63. celery worker -n [email protected] -c 10
  64. celery worker -n [email protected] -c 10
  65. celery worker -n [email protected] -c 10
  66. 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)[源代码]