_celery 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #compdef celery
  2. #autoload
  3. #celery zsh completion
  4. _celery () {
  5. local -a _1st_arguments ifargs dopts controlargs
  6. typeset -A opt_args
  7. _1st_arguments=('worker' 'events' 'beat' 'shell' 'multi' 'amqp' 'status' 'inspect' \
  8. 'control' 'purge' 'list' 'migrate' 'call' 'result' 'report')
  9. ifargs=('--app=' '--broker=' '--loader=' '--config=' '--version')
  10. dopts=('--detach' '--umask=' '--gid=' '--uid=' '--pidfile=' '--logfile=' '--loglevel=')
  11. controlargs=('--timeout' '--destination')
  12. _arguments \
  13. '(-A --app=)'{-A,--app}'[app instance to use (e.g. module.attr_name):APP]' \
  14. '(-b --broker=)'{-b,--broker}'[url to broker. default is "amqp://guest@localhost//":BROKER]' \
  15. '(--loader)--loader[name of custom loader class to use.:LOADER]' \
  16. '(--config)--config[Name of the configuration module:CONFIG]' \
  17. '(--workdir)--workdir[Optional directory to change to after detaching.:WORKING_DIRECTORY]' \
  18. '(-q --quiet)'{-q,--quiet}'[Don"t show as much output.]' \
  19. '(-C --no-color)'{-C,--no-color}'[Don"t display colors.]' \
  20. '(--version)--version[show program"s version number and exit]' \
  21. '(- : *)'{-h,--help}'[show this help message and exit]' \
  22. '*:: :->subcmds' && return 0
  23. if (( CURRENT == 1 )); then
  24. _describe -t commands "celery subcommand" _1st_arguments
  25. return
  26. fi
  27. case "$words[1]" in
  28. worker)
  29. _arguments \
  30. '(-C --concurrency=)'{-C,--concurrency=}'[Number of child processes processing the queue. The default is the number of CPUs.]' \
  31. '(--pool)--pool=:::(processes eventlet gevent threads solo)' \
  32. '(--purge --discard)'{--discard,--purge}'[Purges all waiting tasks before the daemon is started.]' \
  33. '(-f --logfile=)'{-f,--logfile=}'[Path to log file. If no logfile is specified, stderr is used.]' \
  34. '(--loglevel=)--loglevel=:::(critical error warning info debug)' \
  35. '(-N --hostname=)'{-N,--hostname=}'[Set custom hostname, e.g. "foo.example.com".]' \
  36. '(-B --beat)'{-B,--beat}'[Also run the celerybeat periodic task scheduler.]' \
  37. '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database if running with the -B option. Defaults to celerybeat-schedule.]' \
  38. '(-S --statedb=)'{-S,--statedb=}'[Path to the state database.Default: None]' \
  39. '(-E --events)'{-E,--events}'[Send events that can be captured by monitors like celeryev, celerymon, and others.]' \
  40. '(--time-limit=)--time-limit=[nables a hard time limit (in seconds int/float) for tasks]' \
  41. '(--soft-time-limit=)--soft-time-limit=[Enables a soft time limit (in seconds int/float) for tasks]' \
  42. '(--maxtasksperchild=)--maxtasksperchild=[Maximum number of tasks a pool worker can execute before it"s terminated and replaced by a new worker.]' \
  43. '(-Q --queues=)'{-Q,--queues=}'[List of queues to enable for this worker, separated by comma. By default all configured queues are enabled.]' \
  44. '(-I --include=)'{-I,--include=}'[Comma separated list of additional modules to import.]' \
  45. '(--pidfile=)--pidfile=[Optional file used to store the process pid.]' \
  46. '(--autoscale=)--autoscale=[Enable autoscaling by providing max_concurrency, min_concurrency.]' \
  47. '(--autoreload)--autoreload[Enable autoreloading.]' \
  48. '(--no-execv)--no-execv[Don"t do execv after multiprocessing child fork.]'
  49. compadd -a ifargs
  50. ;;
  51. inspect)
  52. _values -s \
  53. 'active[dump active tasks (being processed)]' \
  54. 'active_queues[dump queues being consumed from]' \
  55. 'ping[ping worker(s)]' \
  56. 'registered[dump of registered tasks]' \
  57. 'report[get bugreport info]' \
  58. 'reserved[dump reserved tasks (waiting to be processed)]' \
  59. 'revoked[dump of revoked task ids]' \
  60. 'scheduled[dump scheduled tasks (eta/countdown/retry)]' \
  61. 'stats[dump worker statistics]'
  62. compadd -a controlargs ifargs
  63. ;;
  64. control)
  65. _values -s \
  66. 'add_consumer[tell worker(s) to start consuming a queue]' \
  67. 'autoscale[change autoscale settings]' \
  68. 'cancel_consumer[tell worker(s) to stop consuming a queue]' \
  69. 'disable_events[tell worker(s) to disable events]' \
  70. 'enable_events[tell worker(s) to enable events]' \
  71. 'pool_grow[start more pool processes]' \
  72. 'pool_shrink[use less pool processes]' \
  73. 'rate_limit[tell worker(s) to modify the rate limit for a task type]' \
  74. 'time_limit[tell worker(s) to modify the time limit for a task type.]'
  75. compadd -a controlargs ifargs
  76. ;;
  77. multi)
  78. _values -s \
  79. '--nosplash[Don"t display program info.]' \
  80. '--verbose[Show more output.]' \
  81. '--no-color[Don"t display colors.]' \
  82. '--quiet[Don"t show as much output.]' \
  83. 'start' 'restart' 'stopwait' 'stop' 'show' \
  84. 'names' 'expand' 'get' 'kill'
  85. compadd -a ifargs
  86. ;;
  87. amqp)
  88. _values -s \
  89. 'queue.declare' 'queue.purge' 'exchange.delete' 'basic.publish' \
  90. 'exchange.declare' 'queue.delete' 'queue.bind' 'basic.get'
  91. ;;
  92. list)
  93. _values -s, 'bindings'
  94. ;;
  95. shell)
  96. _values -s \
  97. '--ipython[force iPython.]' \
  98. '--bpython[force bpython.]' \
  99. '--python[force default Python shell.]' \
  100. '--without-tasks[don"t add tasks to locals.]' \
  101. '--eventlet[use eventlet.]' \
  102. '--gevent[use gevent.]'
  103. compadd -a ifargs
  104. ;;
  105. beat)
  106. _arguments \
  107. '(-s --schedule=)'{-s,--schedule=}'[Path to the schedule database. Defaults to celerybeat-schedule.]' \
  108. '(-S --scheduler=)'{-S,--scheduler=}'[Scheduler class to use. Default is celery.beat.PersistentScheduler.]' \
  109. '(--max-interval)--max-interval[]'
  110. compadd -a dopts fargs
  111. ;;
  112. events)
  113. _arguments \
  114. '(-d --dump)'{-d,--dump}'[Dump events to stdout.]' \
  115. '(-c --camera=)'{-c,--camera=}'[Take snapshots of events using this camera.]' \
  116. '(-F --frequency=)'{-F,--frequency=}'[Camera: Shutter frequency. Default is every 1.0 seconds.]' \
  117. '(-r --maxrate=)'{-r,--maxrate=}'[Camera: Optional shutter rate limit (e.g. 10/m).]'
  118. compadd -a dopts fargs
  119. ;;
  120. *)
  121. ;;
  122. esac
  123. }