|
@@ -108,7 +108,7 @@ def multi_args(p, cmd="celeryd", append="", prefix="", suffix=""):
|
|
names = map(str, range(1, int(names[0]) + 1))
|
|
names = map(str, range(1, int(names[0]) + 1))
|
|
prefix = "celery"
|
|
prefix = "celery"
|
|
cmd = options.pop("--cmd", cmd)
|
|
cmd = options.pop("--cmd", cmd)
|
|
- append = options.pop("--append", append)
|
|
|
|
|
|
+ append = options.pop("--append", append)
|
|
hostname = options.pop("--hostname",
|
|
hostname = options.pop("--hostname",
|
|
options.pop("-n", socket.gethostname()))
|
|
options.pop("-n", socket.gethostname()))
|
|
prefix = options.pop("--prefix", prefix) or ""
|
|
prefix = options.pop("--prefix", prefix) or ""
|
|
@@ -131,13 +131,12 @@ def multi_args(p, cmd="celeryd", append="", prefix="", suffix=""):
|
|
yield this_name, line, expand
|
|
yield this_name, line, expand
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def names(argv, cmd):
|
|
def names(argv, cmd):
|
|
p = NamespacedOptionParser(argv)
|
|
p = NamespacedOptionParser(argv)
|
|
print("\n".join(hostname
|
|
print("\n".join(hostname
|
|
for hostname, _, _ in multi_args(p, cmd)))
|
|
for hostname, _, _ in multi_args(p, cmd)))
|
|
|
|
|
|
|
|
+
|
|
def get(argv, cmd):
|
|
def get(argv, cmd):
|
|
wanted = argv[0]
|
|
wanted = argv[0]
|
|
p = NamespacedOptionParser(argv[1:])
|
|
p = NamespacedOptionParser(argv[1:])
|
|
@@ -152,12 +151,14 @@ def start(argv, cmd):
|
|
print("\n".join(worker
|
|
print("\n".join(worker
|
|
for _, worker, _ in multi_args(p, cmd)))
|
|
for _, worker, _ in multi_args(p, cmd)))
|
|
|
|
|
|
|
|
+
|
|
def expand(argv, cmd=None):
|
|
def expand(argv, cmd=None):
|
|
template = argv[0]
|
|
template = argv[0]
|
|
p = NamespacedOptionParser(argv[1:])
|
|
p = NamespacedOptionParser(argv[1:])
|
|
for _, _, expander in multi_args(p, cmd):
|
|
for _, _, expander in multi_args(p, cmd):
|
|
print(expander(template))
|
|
print(expander(template))
|
|
|
|
|
|
|
|
+
|
|
def help(argv, cmd=None):
|
|
def help(argv, cmd=None):
|
|
print("""Some examples:
|
|
print("""Some examples:
|
|
|
|
|
|
@@ -217,7 +218,6 @@ def help(argv, cmd=None):
|
|
celeryd -n xuzzy.myhost -c 3
|
|
celeryd -n xuzzy.myhost -c 3
|
|
""")
|
|
""")
|
|
|
|
|
|
-
|
|
|
|
COMMANDS = {"start": start,
|
|
COMMANDS = {"start": start,
|
|
"names": names,
|
|
"names": names,
|
|
"expand": expand,
|
|
"expand": expand,
|
|
@@ -225,7 +225,9 @@ COMMANDS = {"start": start,
|
|
"help": help}
|
|
"help": help}
|
|
|
|
|
|
def usage():
|
|
def usage():
|
|
- print("Please use one of the following commands: %s" % ", ".join(COMMANDS.keys()))
|
|
|
|
|
|
+ print("Please use one of the following commands: %s" % (
|
|
|
|
+ ", ".join(COMMANDS.keys())))
|
|
|
|
+
|
|
|
|
|
|
def celeryd_multi(argv, cmd="celeryd"):
|
|
def celeryd_multi(argv, cmd="celeryd"):
|
|
if len(argv) == 0:
|
|
if len(argv) == 0:
|
|
@@ -239,6 +241,7 @@ def celeryd_multi(argv, cmd="celeryd"):
|
|
usage()
|
|
usage()
|
|
sys.exit(1)
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
+
|
|
def main():
|
|
def main():
|
|
celeryd_multi(sys.argv[1:])
|
|
celeryd_multi(sys.argv[1:])
|
|
|
|
|