Kaynağa Gözat

Added --cmd-suffix argument to the celeryd-multi tool.

This enables the use of the %n and %h template variables in a command suffix,
like in the following example:

celeryd-multi start 10 -c 1 --cmd="nohup python manage.py celeryd" \
                            --cmd-suffix="> logs/worker%n.txt 2>&1 &"

Effectively sending each worker's output to a separate log file. (Instead of
using the -f parameter.)
Vincent Driessen 15 yıl önce
ebeveyn
işleme
8ef60eab5f
1 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 4 2
      celery/bin/celeryd_multi.py

+ 4 - 2
celery/bin/celeryd_multi.py

@@ -100,7 +100,7 @@ def abbreviations(map):
     return expand
 
 
-def multi_args(p, cmd="celeryd", prefix="", suffix=""):
+def multi_args(p, cmd="celeryd", cmd_suffix="", prefix="", suffix=""):
     names = p.values
     options = dict(p.options)
     ranges = len(names) == 1
@@ -108,6 +108,7 @@ def multi_args(p, cmd="celeryd", prefix="", suffix=""):
         names = map(str, range(1, int(names[0]) + 1))
         prefix = "celery"
     cmd = options.pop("--cmd", cmd)
+    cmd_suffix = options.pop("--cmd-suffix", cmd_suffix)
     hostname = options.pop("--hostname",
                    options.pop("-n", socket.gethostname()))
     prefix = options.pop("--prefix", prefix) or ""
@@ -125,7 +126,8 @@ def multi_args(p, cmd="celeryd", prefix="", suffix=""):
                                 "%n": name})
         line = expand(cmd) + " " + " ".join(
                 format_opt(opt, expand(value))
-                    for opt, value in p.optmerge(name, options).items())
+                    for opt, value in p.optmerge(name, options).items()) + \
+               " " + expand(cmd_suffix)
         yield this_name, line, expand