Permalink
Browse files

Remove BROKER_HOST/USER/PASSWORD/PORT/VHOST from docs, and use URLs c…

…onsistently
1 parent fa957db commit 8f041c6414feff208d060db17087000b4dda8053 @ask committed Jun 2, 2012
@@ -4,7 +4,7 @@
from kombu import Queue
-BROKER_TRANSPORT = "memory"
+BROKER_URL = "memory://"
#: Don't want log output when running suite.
CELERYD_HIJACK_ROOT_LOGGER = False
@@ -3,8 +3,16 @@
from celery.app.defaults import DEFAULTS
-ignore = frozenset(["BROKER_INSIST", "CELERYD_POOL_PUTLOCKS",
- "CELERY_AMQP_TASK_RESULT_CONNECTION_MAX"])
+ignore = frozenset([
+ "BROKER_INSIST",
+ "CELERYD_POOL_PUTLOCKS",
+ "CELERY_AMQP_TASK_RESULT_CONNECTION_MAX",
+ "BROKER_HOST",
+ "BROKER_USER",
+ "BROKER_PASSWORD",
+ "BROKER_VHOST",
+ "BROKER_PORT",
+])
def find_undocumented_settings(directive=".. setting:: "):
View
@@ -21,7 +21,7 @@
# use app loader
from celery import Celery
app = Celery(set_as_current=True)
-app.conf.update(BROKER_TRANSPORT="memory",
+app.conf.update(BROKER_URL="memory://",
CELERY_RESULT_BACKEND="cache",
CELERY_CACHE_BACKEND="memory",
CELERYD_HIJACK_ROOT_LOGGER=False,
@@ -23,23 +23,16 @@ It should contain all you need to run a basic Celery set-up.
.. code-block:: python
+ ## Broker settings.
+ BROKER_URL = "amqp://guest:guest@localhost:5672//"
+
# List of modules to import when celery starts.
CELERY_IMPORTS = ("myapp.tasks", )
- ## Result store settings.
+ ## Using the database to store task state and results.
CELERY_RESULT_BACKEND = "database"
CELERY_RESULT_DBURI = "sqlite:///mydatabase.db"
- ## Broker settings.
- BROKER_URL = "amqp://guest:guest@localhost:5672//"
-
- ## Worker settings
- ## If you're doing mostly I/O you can have more processes,
- ## but if mostly spending CPU, try to keep it close to the
- ## number of CPUs on your machine. If not set, the number of CPUs/cores
- ## available will be used.
- CELERYD_CONCURRENCY = 10
-
CELERY_ANNOTATIONS = {"tasks.add": {"rate_limit": "10/s"}}
@@ -145,6 +138,11 @@ CELERYD_CONCURRENCY
The number of concurrent worker processes/threads/green threads, executing
tasks.
+If you're doing mostly I/O you can have more processes,
+but if mostly CPU-bound, try to keep it close to the
+number of CPUs on your machine. If not set, the number of CPUs/cores
+on the host will be used.
+
Defaults to the number of available CPUs.
.. setting:: CELERYD_PREFETCH_MULTIPLIER
@@ -676,12 +674,6 @@ BROKER_TRANSPORT
:Aliases: ``BROKER_BACKEND``
:Deprecated aliases: ``CARROT_BACKEND``
-The Kombu transport to use. Default is ``amqplib``.
-
-You can use a custom transport class name, or select one of the
-built-in transports: ``amqplib``, ``pika``, ``redis``, ``beanstalk``,
-``sqlalchemy``, ``django``, ``mongodb``, ``couchdb``.
-
.. setting:: BROKER_URL
BROKER_URL
@@ -694,49 +686,14 @@ Default broker URL. This must be an URL in the form of::
Only the scheme part (``transport://``) is required, the rest
is optional, and defaults to the specific transports default values.
-If this setting is defined it will override a subset of the
-other ``BROKER`` options. These options are :setting:`BROKER_HOST`,
-:setting:`BROKER_USER`, :setting:`BROKER_PASSWORD`, :setting:`BROKER_PORT`,
-and :setting:`BROKER_VHOST`.
+The transport part is the broker implementation to use, and the
+default is ``amqp``, but there are many other choices including
+``librabbitmq``, ``amqplib``, ``redis``, ``beanstalk``,
+``sqlalchemy``, ``django``, ``mongodb``, ``couchdb`` and ``pika``.
+It can also be a fully qualified path to your own transport implementation.
See the Kombu documentation for more information about broker URLs.
-.. setting:: BROKER_HOST
-
-BROKER_HOST
-~~~~~~~~~~~
-
-Hostname of the broker.
-
-.. setting:: BROKER_PORT
-
-BROKER_PORT
-~~~~~~~~~~~
-
-Custom port of the broker. Default is to use the default port for the
-selected backend.
-
-.. setting:: BROKER_USER
-
-BROKER_USER
-~~~~~~~~~~~
-
-Username to connect as.
-
-.. setting:: BROKER_PASSWORD
-
-BROKER_PASSWORD
-~~~~~~~~~~~~~~~
-
-Password to connect with.
-
-.. setting:: BROKER_VHOST
-
-BROKER_VHOST
-~~~~~~~~~~~~
-
-Virtual host. Default is `"/"`.
-
.. setting:: BROKER_USE_SSL
BROKER_USE_SSL
@@ -198,14 +198,15 @@ Application
:param url: Either the URL or the hostname of the broker to use.
- :keyword hostname: defaults to the :setting:`BROKER_HOST` setting.
- :keyword userid: defaults to the :setting:`BROKER_USER` setting.
- :keyword password: defaults to the :setting:`BROKER_PASSWORD` setting.
- :keyword virtual_host: defaults to the :setting:`BROKER_VHOST` setting.
- :keyword port: defaults to the :setting:`BROKER_PORT` setting.
- :keyword ssl: defaults to the :setting:`BROKER_USE_SSL` setting.
- :keyword insist: defaults to the :setting:`BROKER_INSIST` setting.
- :keyword backend_cls: defaults to the :setting:`BROKER_TRANSPORT`
+ :keyword hostname: URL, Hostname/IP-address of the broker.
+ If an URL is used, then the other argument below will
+ be taken from the URL instead.
+ :keyword userid: Username to authenticate as.
+ :keyword password: Password to authenticate with
+ :keyword virtual_host: Virtual host to use (domain).
+ :keyword port: Port to connect to.
+ :keyword ssl: Defaults to the :setting:`BROKER_USE_SSL` setting.
+ :keyword transport: defaults to the :setting:`BROKER_TRANSPORT`
setting.
:returns :class:`kombu.connection.BrokerConnection`:
@@ -1,16 +1,8 @@
import atexit
import os
-BROKER_TRANSPORT = (os.environ.get("BROKER_TRANSPORT") or
- os.environ.get("BROKER_BACKEND") or "amqplib")
-
-BROKER_HOST = os.environ.get("BROKER_HOST") or "localhost"
-BROKER_USER = os.environ.get("BROKER_USER") or "guest"
-BROKER_PASSWORD = os.environ.get("BROKER_PASSWORD") or "guest"
-BROKER_VHOST = os.environ.get("BROKER_VHOST") or "/"
-
-
-CELERY_RESULT_BACKEND = "amqp"
+BROKER_URL = os.environ.get("BROKER_URL") or "amqp://"
+CELERY_RESULT_BACKEND = "amqp://"
CELERY_SEND_TASK_ERROR_EMAILS = False
CELERY_DEFAULT_QUEUE = "testcelery"

0 comments on commit 8f041c6

Please sign in to comment.