Skip to content

Commit

Permalink
djcelerymon: Added Command.stdout + Command.stderr. Closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Jan 12, 2011
1 parent 8a6ef28 commit 242eae9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions djcelery/management/commands/djcelerymon.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
"""
Curses Celery Event Viewer.
"""
from threading import Thread
import sys
import threading

from celery.bin import celeryev

Expand All @@ -15,24 +11,29 @@
ev = celeryev.EvCommand(app=app)


class WebserverThread(Thread):
class WebserverThread(threading.Thread):

def __init__(self, addrport="", *args, **options):
Thread.__init__(self)
threading.Thread.__init__(self)
self.addrport = addrport
self.args = args
self.options = options

def run(self):
options = dict(self.options, use_reloader=False)
runserver.Command().handle(self.addrport, *self.args, **options)
command = runserver.Command()
# see http://code.djangoproject.com/changeset/13319
command.stdout, command.stderr = sys.stdout, sys.stderr
command.handle(self.addrport, *self.args, **options)


class Command(CeleryCommand):
"""Run the celery curses event viewer."""
args = '[optional port number, or ipaddr:port]'
option_list = runserver.Command.option_list + ev.get_options()
help = 'Starts Django Admin instance and celerycam in the same process.'
# see http://code.djangoproject.com/changeset/13319.
stdout, stderr = sys.stdout, sys.stderr

def handle(self, addrport="", *args, **options):
"""Handle the management command."""
Expand Down

0 comments on commit 242eae9

Please sign in to comment.