Skip to content

Commit

Permalink
Commands did not use the correct celery App.
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Apr 1, 2011
1 parent a581e62 commit 7742edd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions flaskext/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from functools import partial, wraps

import celery
from celery.app import App
from celery.app import App, current_app as current_celery
from celery.loaders import default as _default
from celery.utils import get_full_cls_name

Expand Down Expand Up @@ -104,7 +104,7 @@ def run(self, **kwargs):
@cached_property
def worker(self):
from celery.bin.celeryd import WorkerCommand
return WorkerCommand(app=Celery(self.app))
return WorkerCommand(app=current_celery())


class celerybeat(Command):
Expand All @@ -119,7 +119,7 @@ def run(self, **kwargs):
@cached_property
def beat(self):
from celery.bin.celerybeat import BeatCommand
return BeatCommand(app=Celery(self.app))
return BeatCommand(app=current_celery())


class celeryev(Command):
Expand All @@ -135,7 +135,7 @@ def run(self, **kwargs):
@cached_property
def ev(self):
from celery.bin.celeryev import EvCommand
return EvCommand(app=Celery(self.app))
return EvCommand(app=current_celery())


class celeryctl(Command):
Expand All @@ -147,8 +147,7 @@ def handle(self, app, prog, name, remaining_args):
if not remaining_args:
remaining_args = ["help"]
from celery.bin.celeryctl import celeryctl as ctl
celery = Celery(app)
ctl(celery).execute_from_commandline(
ctl(current_celery()).execute_from_commandline(
["%s celeryctl" % prog] + remaining_args)


Expand All @@ -160,7 +159,7 @@ def get_options(self):

def handle(self, app, prog, name, remaining_args):
from celery.bin.camqadm import AMQPAdminCommand
return AMQPAdminCommand(app=Celery(self.app)).run(*remaining_args)
return AMQPAdminCommand(app=current_celery()).run(*remaining_args)


commands = {"celeryd": celeryd,
Expand Down

0 comments on commit 7742edd

Please sign in to comment.