瀏覽代碼

celeryd: New option --version: Dump version info and exit.

Ask Solem 15 年之前
父節點
當前提交
030616c9b5
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      celery/bin/celeryd.py

+ 9 - 0
celery/bin/celeryd.py

@@ -97,11 +97,20 @@ Configuration ->
 
 TASK_LIST_FMT = """    . tasks ->\n%s"""
 
+
+def dump_version(*args):
+    print("celeryd v%s" % celery.__version__)
+    sys.exit(0)
+
+
 OPTION_LIST = (
     optparse.make_option('-c', '--concurrency',
             default=conf.CELERYD_CONCURRENCY,
             action="store", dest="concurrency", type="int",
             help="Number of child processes processing the queue."),
+    optparse.make_option('-V', '--version',
+            action="callback", callback=dump_version,
+            help="Show version information and exit."),
     optparse.make_option('--discard', default=False,
             action="store_true", dest="discard",
             help="Discard all waiting tasks before the server is started. "