Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix bugs, auto register tasks

  • Loading branch information...
commit 3d4acd3a44f389405a5847a06bf3ea36c82cdd5d 1 parent 3dc655c
kyle authored
Showing with 9 additions and 2 deletions.
  1. +2 −1  tcelery/__init__.py
  2. +7 −1 tcelery/__main__.py
View
3  tcelery/__init__.py
@@ -21,7 +21,8 @@ def setup_nonblocking_producer(celery_app=None, io_loop=None,
NonBlockingTaskProducer.app = celery_app
NonBlockingTaskProducer.conn_pool = ConnectionPool(limit=limit)
NonBlockingTaskProducer.result_cls = result_cls
- celery.app.amqp.AMQP.producer_cls = NonBlockingTaskProducer
+ if celery_app.conf['BROKER_URL'] and celery_app.conf['BROKER_URL'].startswith('amqp'):
+ celery.app.amqp.AMQP.producer_cls = NonBlockingTaskProducer
def connect():
broker_url = celery_app.connection().as_uri(include_password=True)
View
8 tcelery/__main__.py
@@ -12,9 +12,11 @@
from .app import Application
from . import setup_nonblocking_producer
+from celery.loaders.base import BaseLoader
-define("port", default=8888, type=bool, help="run on the given port")
+define("port", default=8888, type=int, help="run on the given port")
+define("address", default='127.0.0.1', type=str, help="the bind address")
class TCeleryCommand(Command):
@@ -26,6 +28,10 @@ def run_from_argv(self, prog_name, argv=None):
logging.info("Starting http server on port %s..." % options.port)
http_server = httpserver.HTTPServer(Application(celery_app=self.app))
http_server.listen(options.port)
+
+ bloader = BaseLoader()
+ bloader.import_default_modules()
+
logging.info("Registered tasks:")
logging.info(pformat(self.app.tasks.keys()))
Please sign in to comment.
Something went wrong with that request. Please try again.