Skip to content

Commit

Permalink
Skeleton for celeryctl
Browse files Browse the repository at this point in the history
  • Loading branch information
Ask Solem committed Jun 13, 2009
1 parent dbfbd2f commit d40630d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 8 deletions.
10 changes: 10 additions & 0 deletions bin/celeryctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import sys
from celery.bin.celeryctl import celery_control, parse_options

if __name__ == "__main__":
options, values = parse_options(sys.argv[1:])
celery_control(*values, **dict(options))



9 changes: 2 additions & 7 deletions bin/celeryd
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#!/usr/bin/env python
import sys
from celery.bin.celeryd import main, parse_options
from celery.bin.celeryd import run_worker, parse_options

if __name__ == "__main__":
options = parse_options(sys.argv[1:])
main(concurrency=options.concurrency,
daemon=options.daemon,
logfile=options.logfile,
loglevel=options.loglevel,
pidfile=options.pidfile,
queue_wakeup_after=options.queue_wakeup_after)
run_worker(**options)
22 changes: 22 additions & 0 deletions celery/bin/celeryctl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import os
import sys
sys.path.append(os.getcwd())
django_project_dir = os.environ.get("DJANGO_PROJECT_DIR")
if django_project_dir:
sys.path.append(django_project_dir)
from django.conf import settings
import optparse

OPTION_LIST = ()


def parse_options(arguments):
"""Parse the available options to ``celeryctl``."""
parser = optparse.OptionParser(option_list=OPTION_LIST)
options, values = parser.parse_args(arguments)
return options, values


def celery_control(*args, **kwargs):
print("ARGS: %s" % args)
print("KWARGS: %s" % kwargs)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run(self):
url=celery.__homepage__,
platforms=["any"],
packages=find_packages(exclude=['ez_setup']),
scripts=["bin/celeryd"],
scripts=["bin/celeryd", "bin/celeryctl"],
zip_safe=False,
install_requires=[
'carrot>=0.4.1',
Expand Down

0 comments on commit d40630d

Please sign in to comment.