Permalink
Browse files

Cosmetics

  • Loading branch information...
1 parent 517aed7 commit ddc7389c6cdcab34c3e97e49f1823097c6648196 @ask committed Dec 8, 2011
Showing with 16 additions and 11 deletions.
  1. +4 −3 celery/worker/autoreload.py
  2. +0 −1 celery/worker/job.py
  3. +12 −7 docs/userguide/workers.rst
@@ -3,8 +3,9 @@
celery.worker.autoreload
~~~~~~~~~~~~~~~~~~~~~~~~
- This module implements the automatic module reloading
+ This module implements automatic module reloading
"""
+from __future__ import absolute_import
from __future__ import with_statement
import os
@@ -15,7 +16,7 @@
from collections import defaultdict
-from celery.task.control import broadcast
+from .. import current_app
def file_hash(filename, algorithm='md5'):
@@ -170,7 +171,7 @@ def on_change(self, files):
self._reload(map(self._module_name, modified))
def _reload(self, modules):
- broadcast("pool_restart",
+ current_app.control.broadcast("pool_restart",
arguments={"imports": modules, "reload_modules": True})
@classmethod
View
@@ -17,7 +17,6 @@
import socket
from datetime import datetime
-from operator import itemgetter
from .. import exceptions
from ..registry import tasks
View
@@ -359,11 +359,16 @@ Adding/Reloading modules
.. versionadded:: 2.5
-`pool_restart` command sends restart requests to all worker processes.
-It is particularly useful for reloading imported modules or adding new
-ones. `pool_restart` command doesn't interrupt executing tasks.
+The remote control command ``pool_restart`` sends restart requests to
+the workers child processes. It is particularly useful for forcing
+the worker to import new modules, or for reloading already imported
+modules. This command does not interrupt executing tasks.
-The following command adds `foo` and `bar` modules:
+Example
+~~~~~~~
+
+Runnig the following command will result in the `foo` and `bar` modules
+being imported by the worker processes:
.. code-block:: python
@@ -388,17 +393,17 @@ reloader as well.
.. note::
-Module reloading has some caveats which are documented in `reload`_.
+Module reloading comes with some caveats that are documented in :fun:`reload`.
Make sure your modules are suitable for reloading.
-.. _`reload`: http://docs.python.org/library/functions.html#reload
-
.. seealso::
http://pyunit.sourceforge.net/notes/reloading.html
http://www.indelible.org/ink/python-reloading/
+http://docs.python.org/library/functions.html#reload
+
.. _worker-custom-control-commands:
Writing your own remote control commands

0 comments on commit ddc7389

Please sign in to comment.