Browse Source

Docs: Use celery -A proj consistently

Ask Solem 10 years ago
parent
commit
6449e7ee28

+ 8 - 8
docs/faq.rst

@@ -361,14 +361,14 @@ all configured task queues:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery purge
+    $ celery -A proj purge
 
 
 or programatically:
 or programatically:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
-    >>> from celery import current_app as celery
-    >>> celery.control.purge()
+    >>> from proj.celery import app
+    >>> app.control.purge()
     1753
     1753
 
 
 If you only want to purge messages from a specific queue
 If you only want to purge messages from a specific queue
@@ -376,7 +376,7 @@ you have to use the AMQP API or the :program:`celery amqp` utility:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery amqp queue.purge <queue name>
+    $ celery -A proj amqp queue.purge <queue name>
 
 
 The number 1753 is the number of messages deleted.
 The number 1753 is the number of messages deleted.
 
 
@@ -680,8 +680,8 @@ Can I cancel the execution of a task?
 
 
 or if you only have the task id::
 or if you only have the task id::
 
 
-    >>> from celery import current_app as celery
-    >>> celery.control.revoke(task_id)
+    >>> from proj.celery import app
+    >>> app.control.revoke(task_id)
 
 
 .. _faq-node-not-receiving-broadcast-commands:
 .. _faq-node-not-receiving-broadcast-commands:
 
 
@@ -698,8 +698,8 @@ using the :option:`-n` argument to :mod:`~celery.bin.worker`:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker -n worker1@%h
-    $ celery worker -n worker2@%h
+    $ celery -A proj worker -n worker1@%h
+    $ celery -A proj worker -n worker2@%h
 
 
 where ``%h`` is automatically expanded into the current hostname.
 where ``%h`` is automatically expanded into the current hostname.
 
 

+ 3 - 3
docs/getting-started/next-steps.rst

@@ -74,7 +74,7 @@ The :program:`celery` program can be used to start the worker:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker --app=proj -l info
+    $ celery -A proj worker -l info
 
 
 When the worker starts you should see a banner and some messages::
 When the worker starts you should see a banner and some messages::
 
 
@@ -160,7 +160,7 @@ You can restart it too:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery multi restart w1 -A proj -l info
+    $ celery  multi restart w1 -A proj -l info
     celery multi v3.1.1 (Cipater)
     celery multi v3.1.1 (Cipater)
     > Stopping nodes...
     > Stopping nodes...
         > w1.halcyon.local: TERM -> 64024
         > w1.halcyon.local: TERM -> 64024
@@ -201,7 +201,7 @@ you are encouraged to put these in a dedicated directory:
     $ mkdir -p /var/run/celery
     $ mkdir -p /var/run/celery
     $ mkdir -p /var/log/celery
     $ mkdir -p /var/log/celery
     $ celery multi start w1 -A proj -l info --pidfile=/var/run/celery/%n.pid \
     $ celery multi start w1 -A proj -l info --pidfile=/var/run/celery/%n.pid \
-                                            --logfile=/var/log/celery/%n.pid
+                                            --logfile=/var/log/celery/%n%I.log
 
 
 With the multi command you can start multiple workers, and there is a powerful
 With the multi command you can start multiple workers, and there is a powerful
 command-line syntax to specify arguments for different workers too,
 command-line syntax to specify arguments for different workers too,

+ 5 - 1
docs/tutorials/daemonizing.rst

@@ -55,10 +55,14 @@ must also export them (e.g. ``export DISPLAY=":0"``)
     .. code-block:: bash
     .. code-block:: bash
 
 
         $ celery multi start worker1 \
         $ celery multi start worker1 \
+            -A proj \
             --pidfile="$HOME/run/celery/%n.pid" \
             --pidfile="$HOME/run/celery/%n.pid" \
             --logfile="$HOME/log/celery/%n%I.log"
             --logfile="$HOME/log/celery/%n%I.log"
 
 
-        $ celery multi restart worker1 --pidfile="$HOME/run/celery/%n.pid"
+        $ celery multi restart worker1 \
+            -A proj \
+            --logfile="$HOME/log/celery/%n%I.log" \
+            --pidfile="$HOME/run/celery/%n.pid
 
 
         $ celery multi stopwait worker1 --pidfile="$HOME/run/celery/%n.pid"
         $ celery multi stopwait worker1 --pidfile="$HOME/run/celery/%n.pid"
 
 

+ 1 - 1
docs/userguide/calling.rst

@@ -468,7 +468,7 @@ the workers :option:`-Q` argument:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker -l info -Q celery,priority.high
+    $ celery -A proj worker -l info -Q celery,priority.high
 
 
 .. seealso::
 .. seealso::
 
 

+ 1 - 1
docs/userguide/concurrency/eventlet.rst

@@ -44,7 +44,7 @@ You can enable the Eventlet pool by using the ``-P`` option to
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker -P eventlet -c 1000
+    $ celery -A proj worker -P eventlet -c 1000
 
 
 .. _eventlet-examples:
 .. _eventlet-examples:
 
 

+ 25 - 24
docs/userguide/monitoring.rst

@@ -58,32 +58,33 @@ Commands
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-            $ celery status
+            $ celery -A proj status
 
 
 * **result**: Show the result of a task
 * **result**: Show the result of a task
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery result -t tasks.add 4e196aa4-0141-4601-8138-7aa33db0f577
+        $ celery -A proj result -t tasks.add 4e196aa4-0141-4601-8138-7aa33db0f577
 
 
     Note that you can omit the name of the task as long as the
     Note that you can omit the name of the task as long as the
     task doesn't use a custom result backend.
     task doesn't use a custom result backend.
 
 
 * **purge**: Purge messages from all configured task queues.
 * **purge**: Purge messages from all configured task queues.
 
 
-    .. code-block:: bash
-
-        $ celery purge
-
     .. warning::
     .. warning::
         There is no undo for this operation, and messages will
         There is no undo for this operation, and messages will
         be permanently deleted!
         be permanently deleted!
 
 
+    .. code-block:: bash
+
+        $ celery -A proj purge
+
+
 * **inspect active**: List active tasks
 * **inspect active**: List active tasks
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect active
+        $ celery -A proj inspect active
 
 
     These are all the tasks that are currently being executed.
     These are all the tasks that are currently being executed.
 
 
@@ -91,7 +92,7 @@ Commands
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect scheduled
+        $ celery -A proj inspect scheduled
 
 
     These are tasks reserved by the worker because they have the
     These are tasks reserved by the worker because they have the
     `eta` or `countdown` argument set.
     `eta` or `countdown` argument set.
@@ -100,7 +101,7 @@ Commands
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect reserved
+        $ celery -A proj inspect reserved
 
 
     This will list all tasks that have been prefetched by the worker,
     This will list all tasks that have been prefetched by the worker,
     and is currently waiting to be executed (does not include tasks
     and is currently waiting to be executed (does not include tasks
@@ -110,37 +111,37 @@ Commands
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect revoked
+        $ celery -A proj inspect revoked
 
 
 * **inspect registered**: List registered tasks
 * **inspect registered**: List registered tasks
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect registered
+        $ celery -A proj inspect registered
 
 
 * **inspect stats**: Show worker statistics (see :ref:`worker-statistics`)
 * **inspect stats**: Show worker statistics (see :ref:`worker-statistics`)
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery inspect stats
+        $ celery -A proj inspect stats
 
 
 * **control enable_events**: Enable events
 * **control enable_events**: Enable events
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery control enable_events
+        $ celery -A proj control enable_events
 
 
 * **control disable_events**: Disable events
 * **control disable_events**: Disable events
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery control disable_events
+        $ celery -A proj control disable_events
 
 
 * **migrate**: Migrate tasks from one broker to another (**EXPERIMENTAL**).
 * **migrate**: Migrate tasks from one broker to another (**EXPERIMENTAL**).
 
 
     .. code-block:: bash
     .. code-block:: bash
 
 
-        $ celery migrate redis://localhost amqp://localhost
+        $ celery -A proj migrate redis://localhost amqp://localhost
 
 
   This command will migrate all the tasks on one broker to another.
   This command will migrate all the tasks on one broker to another.
   As this command is new and experimental you should be sure to have
   As this command is new and experimental you should be sure to have
@@ -164,9 +165,9 @@ You can specify a single, or a list of workers by using the
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery inspect -d w1,w2 reserved
+    $ celery -A proj inspect -d w1,w2 reserved
 
 
-    $ celery control -d w1,w2 enable_events
+    $ celery -A proj control -d w1,w2 enable_events
 
 
 
 
 .. _monitoring-flower:
 .. _monitoring-flower:
@@ -232,13 +233,13 @@ Running the flower command will start a web-server that you can visit:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery flower
+    $ celery -A proj flower
 
 
 The default port is http://localhost:5555, but you can change this using the `--port` argument:
 The default port is http://localhost:5555, but you can change this using the `--port` argument:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery flower --port=5555
+    $ celery -A proj flower --port=5555
 
 
 Broker URL can also be passed through the `--broker` argument :
 Broker URL can also be passed through the `--broker` argument :
 
 
@@ -273,7 +274,7 @@ Starting:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery events
+    $ celery -A proj events
 
 
 You should see a screen like:
 You should see a screen like:
 
 
@@ -285,13 +286,13 @@ You should see a screen like:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery events --camera=<camera-class> --frequency=1.0
+    $ celery -A proj events --camera=<camera-class> --frequency=1.0
 
 
 and it includes a tool to dump events to :file:`stdout`:
 and it includes a tool to dump events to :file:`stdout`:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery events --dump
+    $ celery -A proj events --dump
 
 
 For a complete list of options use ``--help``:
 For a complete list of options use ``--help``:
 
 
@@ -457,7 +458,7 @@ arguments:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery events -c myapp.Camera --frequency=2.0
+    $ celery -A proj events -c myapp.Camera --frequency=2.0
 
 
 
 
 .. _monitoring-camera:
 .. _monitoring-camera:
@@ -497,7 +498,7 @@ it with the :option:`-c` option:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery events -c myapp.DumpCam --frequency=2.0
+    $ celery -A proj events -c myapp.DumpCam --frequency=2.0
 
 
 Or you can use it programmatically like this:
 Or you can use it programmatically like this:
 
 

+ 3 - 3
docs/userguide/periodic-tasks.rst

@@ -247,7 +247,7 @@ To start the :program:`celery beat` service:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery beat
+    $ celery -A proj beat
 
 
 You can also start embed `beat` inside the worker by enabling
 You can also start embed `beat` inside the worker by enabling
 workers `-B` option, this is convenient if you will never run
 workers `-B` option, this is convenient if you will never run
@@ -256,7 +256,7 @@ reason is not recommended for production use:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker -B
+    $ celery -A proj worker -B
 
 
 Beat needs to store the last run times of the tasks in a local database
 Beat needs to store the last run times of the tasks in a local database
 file (named `celerybeat-schedule` by default), so it needs access to
 file (named `celerybeat-schedule` by default), so it needs access to
@@ -265,7 +265,7 @@ location for this file:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery beat -s /home/celery/var/run/celerybeat-schedule
+    $ celery -A proj beat -s /home/celery/var/run/celerybeat-schedule
 
 
 
 
 .. note::
 .. note::

+ 8 - 8
docs/userguide/routing.rst

@@ -45,14 +45,14 @@ Now you can start server `z` to only process the feeds queue like this:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    user@z:/$ celery worker -Q feeds
+    user@z:/$ celery -A proj worker -Q feeds
 
 
 You can specify as many queues as you want, so you can make this server
 You can specify as many queues as you want, so you can make this server
 process the default queue as well:
 process the default queue as well:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    user@z:/$ celery worker -Q feeds,celery
+    user@z:/$ celery -A proj worker -Q feeds,celery
 
 
 .. _routing-changing-default-queue:
 .. _routing-changing-default-queue:
 
 
@@ -147,21 +147,21 @@ start it with the ``-Q`` option:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    user@z:/$ celery worker -Q feed_tasks --hostname=z@%h
+    user@z:/$ celery -A proj worker -Q feed_tasks --hostname=z@%h
 
 
 Servers `x` and `y` must be configured to consume from the default queue:
 Servers `x` and `y` must be configured to consume from the default queue:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    user@x:/$ celery worker -Q default --hostname=x@%h
-    user@y:/$ celery worker -Q default --hostname=y@%h
+    user@x:/$ celery -A proj worker -Q default --hostname=x@%h
+    user@y:/$ celery -A proj worker -Q default --hostname=y@%h
 
 
 If you want, you can even have your feed processing worker handle regular
 If you want, you can even have your feed processing worker handle regular
 tasks as well, maybe in times when there's a lot of work to do:
 tasks as well, maybe in times when there's a lot of work to do:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
-    user@z:/$ celery worker -Q feed_tasks,default --hostname=z@%h
+    user@z:/$ celery -A proj worker -Q feed_tasks,default --hostname=z@%h
 
 
 If you have another queue but on another exchange you want to add,
 If you have another queue but on another exchange you want to add,
 just specify a custom exchange and exchange type:
 just specify a custom exchange and exchange type:
@@ -367,7 +367,7 @@ or just start with no arguments to start it in shell-mode:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery amqp
+    $ celery -A proj amqp
     -> connecting to amqp://guest@localhost:5672/.
     -> connecting to amqp://guest@localhost:5672/.
     -> connected.
     -> connected.
     1>
     1>
@@ -381,7 +381,7 @@ Let's create a queue you can send messages to:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery amqp
+    $ celery -A proj amqp
     1> exchange.declare testexchange direct
     1> exchange.declare testexchange direct
     ok.
     ok.
     2> queue.declare testqueue
     2> queue.declare testqueue

+ 2 - 2
docs/userguide/tasks.rst

@@ -1166,8 +1166,8 @@ yourself:
 
 
 .. code-block:: python
 .. code-block:: python
 
 
-    >>> from celery import current_app
-    >>> current_app.tasks
+    >>> from proj.celery import app
+    >>> app.tasks
     {'celery.chord_unlock':
     {'celery.chord_unlock':
         <@task: celery.chord_unlock>,
         <@task: celery.chord_unlock>,
      'celery.backend_cleanup':
      'celery.backend_cleanup':

+ 7 - 7
docs/userguide/workers.rst

@@ -23,7 +23,7 @@ You can start the worker in the foreground by executing the command:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery --app=app worker -l info
+    $ celery -A proj worker -l info
 
 
 For a full list of available command-line options see
 For a full list of available command-line options see
 :mod:`~celery.bin.worker`, or simply do:
 :mod:`~celery.bin.worker`, or simply do:
@@ -38,9 +38,9 @@ host name with the :option:`--hostname|-n` argument:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker --loglevel=INFO --concurrency=10 -n worker1.%h
-    $ celery worker --loglevel=INFO --concurrency=10 -n worker2.%h
-    $ celery worker --loglevel=INFO --concurrency=10 -n worker3.%h
+    $ celery -A proj worker --loglevel=INFO --concurrency=10 -n worker1.%h
+    $ celery -A proj worker --loglevel=INFO --concurrency=10 -n worker2.%h
+    $ celery -A proj worker --loglevel=INFO --concurrency=10 -n worker3.%h
 
 
 The hostname argument can expand the following variables:
 The hostname argument can expand the following variables:
 
 
@@ -560,7 +560,7 @@ by giving a comma separated list of queues to the :option:`-Q` option:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery worker -l info -Q foo,bar,baz
+    $ celery -A proj worker -l info -Q foo,bar,baz
 
 
 If the queue name is defined in :setting:`CELERY_QUEUES` it will use that
 If the queue name is defined in :setting:`CELERY_QUEUES` it will use that
 configuration, but if it's not defined in the list of queues Celery will
 configuration, but if it's not defined in the list of queues Celery will
@@ -663,7 +663,7 @@ the :control:`active_queues` control command:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery inspect active_queues
+    $ celery -A proj inspect active_queues
     [...]
     [...]
 
 
 Like all other remote control commands this also supports the
 Like all other remote control commands this also supports the
@@ -672,7 +672,7 @@ reply to the request:
 
 
 .. code-block:: bash
 .. code-block:: bash
 
 
-    $ celery inspect active_queues -d worker1.local
+    $ celery -A proj inspect active_queues -d worker1.local
     [...]
     [...]