celery.zsh 6.2 KB

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