celery.bin.multi

Examples


1. # Single worker with explicit name and events enabled.
2. $ celery multi start Leslie -E

4. # Pidfiles and logfiles are stored in the current directory
5. # by default.  Use --pidfile and --logfile argument to change
6. # this.  The abbreviation %N will be expanded to the current
7. # node name.
8. $ celery multi start Leslie -E --pidfile=/var/run/celery/%N.pid
9. --logfile=/var/log/celery/%N.log

12. # You need to add the same arguments when you restart,
13. # as these are not persisted anywhere.
14. $ celery multi restart Leslie -E --pidfile=/var/run/celery/%N.pid
15. --logfile=/var/run/celery/%N.log

17. # To stop the node, you need to specify the same pidfile.
18. $ celery multi stop Leslie --pidfile=/var/run/celery/%N.pid

20. # 3 workers, with 3 processes each
21. $ celery multi start 3 -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

26. # start 3 named workers
27. $ celery multi start image video data -c 3
28. celery worker -n [email protected] -c 3
29. celery worker -n [email protected] -c 3
30. celery worker -n [email protected] -c 3

32. # specify custom hostname
33. $ celery multi start 2 --hostname=worker.example.com -c 3
34. celery worker -n [email protected] -c 3
35. celery worker -n [email protected] -c 3

37. # specify fully qualified nodenames
38. $ celery multi start [email protected] [email protected] -c 3

40. # Advanced example starting 10 workers in the background:
41. #   * Three of the workers processes the images and video queue
42. #   * Two of the workers processes the data queue with loglevel DEBUG
43. #   * the rest processes the default' queue.
44. $ celery multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
45. -Q default -L:4,5 DEBUG

47. # You can show the commands necessary to start the workers with
48. # the 'show' command:
49. $ celery multi show 10 -l INFO -Q:1-3 images,video -Q:4,5 data
50. -Q default -L:4,5 DEBUG

52. # Additional options are added to each celery worker' comamnd,
53. # but you can also modify the options for ranges of, or specific workers

55. # 3 workers: Two with 3 processes, and one with 10 processes.
56. $ celery multi start 3 -c 3 -c:1 10
57. celery worker -n [email protected] -c 10
58. celery worker -n [email protected] -c 3
59. celery worker -n [email protected] -c 3

61. # can also specify options for named workers
62. $ celery multi start image video data -c 3 -c:image 10
63. celery worker -n [email protected] -c 10
64. celery worker -n [email protected] -c 3
65. celery worker -n [email protected] -c 3

67. # ranges and lists of workers in options is also allowed:
68. # (-c:1-3 can also be written as -c:1,2,3)
69. $ celery multi start 5 -c 3  -c:1-3 10
70. celery worker -n [email protected] -c 10
71. celery worker -n [email protected] -c 10
72. celery worker -n [email protected] -c 10
73. celery worker -n [email protected] -c 3
74. celery worker -n [email protected] -c 3

76. # lists also works with named workers
77. $ celery multi start foo bar baz xuzzy -c 3 -c:foo,bar,baz 10
78. celery worker -n [email protected] -c 10
79. celery worker -n [email protected] -c 10
80. celery worker -n [email protected] -c 10
81. 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)[源代码]