Prechádzať zdrojové kódy

ReadTheDocs related documentation changes

Ask Solem 14 rokov pred
rodič
commit
0851fe1680

+ 13 - 5
celery/concurrency/threads.py

@@ -1,20 +1,28 @@
-from threadpool import ThreadPool, WorkRequest
-
 from celery.concurrency.base import apply_target, BasePool
 
 
 class TaskPool(BasePool):
 
+    def __init__(self, *args, **kwargs):
+        try:
+            import threadpool
+        except ImportError:
+            raise ImportError(
+                    "The threaded pool requires the threadpool module.")
+        self.WorkRequest = threadpool.WorkRequest
+        self.ThreadPool = threadpool.ThreadPool
+        super(TaskPool, self).__init__(*args, **kwargs)
+
     def on_start(self):
-        self._pool = ThreadPool(self.limit)
+        self._pool = self.ThreadPool(self.limit)
 
     def on_stop(self):
         self._pool.dismissWorkers(self.limit, do_join=True)
 
     def on_apply(self, target, args=None, kwargs=None, callback=None,
             accept_callback=None, **_):
-        req = WorkRequest(apply_target, (target, args, kwargs, callback,
-                                         accept_callback))
+        req = self.WorkRequest(apply_target, (target, args, kwargs, callback,
+                                              accept_callback))
         self._pool.putRequest(req)
         # threadpool also has callback support,
         # but for some reason the callback is not triggered

+ 3 - 0
contrib/requirements/docs.txt

@@ -0,0 +1,3 @@
+Sphinx
+sphinxcontrib-issuetracker
+SQLAlchemy

+ 1 - 1
docs/getting-started/first-steps-with-celery.rst

@@ -110,7 +110,7 @@ see what's going on in the terminal::
 
 In production you will probably want to run the worker in the
 background as a daemon.  To do this you need to use the tools provided
-by your platform, or something like `supervisord`_ (see :ref:`daemonization`
+by your platform, or something like `supervisord`_ (see :ref:`daemonizing`
 for more information).
 
 For a complete listing of the command line options available, do::

+ 1 - 1
docs/userguide/optimizing.rst

@@ -1,4 +1,4 @@
-.. _optimizing:
+.. _guide-optimizing:
 
 ============
  Optimizing

+ 2 - 4
docs/userguide/tasks.rst

@@ -263,8 +263,6 @@ General
     The global default can be overridden by the :setting:`CELERY_ACKS_LATE`
     setting.
 
-.. _task-track-started:
-
 .. attribute:: Task.track_started
 
     If :const:`True` the task will report its status as "started"
@@ -420,7 +418,7 @@ add the project directory to the Python path::
 
 This makes more sense from the reusable app perspective anyway.
 
-.. tasks-decorating:
+.. _tasks-decorating:
 
 Decorating tasks
 ================
@@ -561,7 +559,7 @@ STARTED
 ~~~~~~~
 
 Task has been started.
-Not reported by default, to enable please see :ref:`task-track-started`.
+Not reported by default, to enable please see :attr`Task.track_started`.
 
 :metadata: `pid` and `hostname` of the worker process executing
            the task.