Parcourir la source

Autogenerated documentation for github.

Ask Solem il y a 16 ans
Parent
commit
4999fcb011

+ 18 - 0
faq.html

@@ -69,6 +69,24 @@ Transaction Model and Locking</a> in the MySQL user manual.</p>
 <h3>celeryd is not doing anything, just hanging<a class="headerlink" href="#celeryd-is-not-doing-anything-just-hanging" title="Permalink to this headline">¶</a></h3>
 <p><strong>Answer:</strong> See <a class="reference internal" href="#mysql-is-throwing-deadlock-errors-what-can-i-do">MySQL is throwing deadlock errors, what can I do?</a>.</p>
 </div>
+<div class="section" id="i-m-having-integrityerror-duplicate-key-errors-why">
+<h3>I&#8217;m having <tt class="docutils literal"><span class="pre">IntegrityError:</span> <span class="pre">Duplicate</span> <span class="pre">Key</span></tt> errors. Why?<a class="headerlink" href="#i-m-having-integrityerror-duplicate-key-errors-why" title="Permalink to this headline">¶</a></h3>
+<p><strong>Answer:</strong> See <a class="reference internal" href="#mysql-is-throwing-deadlock-errors-what-can-i-do">MySQL is throwing deadlock errors, what can I do?</a>.
+Thanks to howsthedotcom.</p>
+</div>
+<div class="section" id="my-periodic-tasks-won-t-run">
+<h3>My Periodic Tasks won&#8217;t run<a class="headerlink" href="#my-periodic-tasks-won-t-run" title="Permalink to this headline">¶</a></h3>
+<p><strong>Answer:</strong> Did you register the task in the applications <tt class="docutils literal"><span class="pre">tasks.py</span></tt> module?
+(or in some other module Django loads by default, like <tt class="docutils literal"><span class="pre">models.py</span></tt>?).</p>
+<p>You can find out if the celery daemon is able to run the task by executing the
+periodic task manually, by doing the following:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">myapp.tasks</span> <span class="kn">import</span> <span class="n">MyPeriodicTask</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">MyPeriodicTask</span><span class="o">.</span><span class="n">delay</span><span class="p">()</span>
+</pre></div>
+</div>
+<p>Watch celery daemons logfile (or output if not running as a daemon), to see
+if it&#8217;s able to find the task, or if some other error is happening.</p>
+</div>
 <div class="section" id="can-i-send-some-tasks-to-only-some-servers">
 <h3>Can I send some tasks to only some servers?<a class="headerlink" href="#can-i-send-some-tasks-to-only-some-servers" title="Permalink to this headline">¶</a></h3>
 <p>As of now there is only one use-case that works like this, and that is

+ 10 - 23
genindex.html

@@ -45,7 +45,7 @@
 
    <h1 id="index">Index</h1>
 
-   <a href="#Symbols"><strong>Symbols</strong></a> | <a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#J"><strong>J</strong></a> | <a href="#K"><strong>K</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#O"><strong>O</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#Q"><strong>Q</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#U"><strong>U</strong></a> | <a href="#W"><strong>W</strong></a> 
+   <a href="#Symbols"><strong>Symbols</strong></a> | <a href="#A"><strong>A</strong></a> | <a href="#B"><strong>B</strong></a> | <a href="#C"><strong>C</strong></a> | <a href="#D"><strong>D</strong></a> | <a href="#E"><strong>E</strong></a> | <a href="#F"><strong>F</strong></a> | <a href="#G"><strong>G</strong></a> | <a href="#I"><strong>I</strong></a> | <a href="#J"><strong>J</strong></a> | <a href="#K"><strong>K</strong></a> | <a href="#L"><strong>L</strong></a> | <a href="#M"><strong>M</strong></a> | <a href="#N"><strong>N</strong></a> | <a href="#P"><strong>P</strong></a> | <a href="#Q"><strong>Q</strong></a> | <a href="#R"><strong>R</strong></a> | <a href="#S"><strong>S</strong></a> | <a href="#T"><strong>T</strong></a> | <a href="#U"><strong>U</strong></a> | <a href="#W"><strong>W</strong></a> 
 
    <hr />
 
@@ -84,9 +84,8 @@
 <table width="100%" class="indextable"><tr><td width="33%" valign="top">
 <dl>
 
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.add">add() (celery.datastructures.TaskProcessQueue method)</a></dt>
 <dt><a href="reference/celery.registry.html#celery.registry.AlreadyRegistered">AlreadyRegistered</a></dt>
-<dt><a href="reference/celery.conf.html#celery.conf.AMQP_CONSUMER_QUEUE">AMQP_CONSUMER_QUEUE (in module celery.conf)</a></dt>
+<dt><a href="reference/celery.conf.html#celery.conf.AMQP_CONSUMER_QUEUE">AMQP_CONSUMER_QUEUE (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.AMQP_CONSUMER_QUEUE">[1]</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.AMQP_CONSUMER_ROUTING_KEY">AMQP_CONSUMER_ROUTING_KEY (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.AMQP_CONSUMER_ROUTING_KEY">[1]</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.AMQP_EXCHANGE">AMQP_EXCHANGE (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.AMQP_EXCHANGE">[1]</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.AMQP_EXCHANGE_TYPE">AMQP_EXCHANGE_TYPE (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.AMQP_EXCHANGE_TYPE">[1]</a></dt>
@@ -173,7 +172,8 @@
 <dt><a href="reference/celery.conf.html#celery.conf.DAEMON_PID_FILE">DAEMON_PID_FILE (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.DAEMON_PID_FILE">[1]</a></dt>
 <dt><a href="reference/celery.platform.html#celery.platform.daemonize">daemonize() (in module celery.platform)</a></dt>
 <dt><a href="reference/celery.models.html#TaskMeta.date_done">date_done (TaskMeta attribute)</a></dt>
-<dt><a href="reference/celery.conf.html#celery.conf.DEFAULT_REAP_TIMEOUT">DEFAULT_REAP_TIMEOUT (in module celery.conf)</a></dt>
+<dt><a href="reference/celery.messaging.html#celery.messaging.TaskConsumer.decoder">decoder() (celery.messaging.TaskConsumer method)</a></dt>
+<dt><a href="reference/celery.conf.html#celery.conf.DEFAULT_DAEMON_LOG_FILE">DEFAULT_DAEMON_LOG_FILE (in module celery.conf)</a></dt>
 <dt><a href="reference/celery.backends.html#celery.backends.DefaultBackend">DefaultBackend (class in celery.backends)</a></dt>
 <dt><a href="reference/celery.task.html#celery.task.Task.delay">delay() (celery.task.Task class method)</a></dt>
   <dd><dl>
@@ -189,7 +189,6 @@
 <dt><a href="reference/celery.task.html#celery.task.discard_all">discard_all() (in module celery.task)</a></dt>
 <dt><a href="reference/celery.task.html#celery.task.dmap">dmap() (in module celery.task)</a></dt>
 <dt><a href="reference/celery.task.html#celery.task.dmap_async">dmap_async() (in module celery.task)</a></dt>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.done_msg">done_msg (celery.datastructures.TaskProcessQueue attribute)</a></dt>
 </dl></td></tr></table>
 
 <h2 id="E">E</h2>
@@ -200,6 +199,7 @@
 <dt><a href="reference/celery.worker.html#celery.worker.WorkController.empty_msg_emit_every">empty_msg_emit_every (celery.worker.WorkController attribute)</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.EMPTY_MSG_EMIT_EVERY">EMPTY_MSG_EMIT_EVERY (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.EMPTY_MSG_EMIT_EVERY">[1]</a></dt>
 <dt><a href="reference/celery.worker.html#celery.worker.EmptyQueue">EmptyQueue</a></dt>
+<dt><a href="reference/celery.messaging.html#celery.messaging.TaskPublisher.encoder">encoder() (celery.messaging.TaskPublisher method)</a></dt>
 <dt><a href="reference/celery.timer.html#celery.timer.EventTimer.event">event (celery.timer.EventTimer attribute)</a></dt>
 <dt><a href="reference/celery.timer.html#celery.timer.EventTimer">EventTimer (class in celery.timer)</a></dt>
 <dt><a href="reference/celery.backends.base.html#celery.backends.base.BaseBackend.UnpickleableExceptionWrapper.exc_args">exc_args (celery.backends.base.BaseBackend.UnpickleableExceptionWrapper attribute)</a></dt>
@@ -251,13 +251,13 @@
 <dt><a href="reference/celery.backends.html#celery.backends.get_default_periodicstatus_backend_cls">get_default_periodicstatus_backend_cls() (in module celery.backends)</a></dt>
 <dt><a href="reference/celery.task.html#celery.task.Task.get_logger">get_logger() (celery.task.Task method)</a></dt>
 <dt><a href="reference/celery.platform.html#celery.platform.PIDFile.get_pid">get_pid() (celery.platform.PIDFile method)</a></dt>
-<dt><a href="reference/celery.task.html#celery.task.Task.get_publisher">get_publisher() (celery.task.Task method)</a></dt>
+<dt><a href="reference/celery.task.html#celery.task.Task.get_publisher">get_publisher() (celery.task.Task method)</a></dt></dl></td><td width="33%" valign="top"><dl>
 <dt><a href="reference/celery.backends.base.html#celery.backends.base.BaseBackend.get_result">get_result() (celery.backends.base.BaseBackend method)</a></dt>
   <dd><dl>
     <dt><a href="reference/celery.backends.cache.html#celery.backends.cache.Backend.get_result">(celery.backends.cache.Backend method)</a></dt>
     <dt><a href="reference/celery.backends.database.html#celery.backends.database.Backend.get_result">(celery.backends.database.Backend method)</a></dt>
     <dt><a href="reference/celery.backends.tyrant.html#celery.backends.tyrant.Backend.get_result">(celery.backends.tyrant.Backend method)</a></dt>
-  </dl></dd></dl></td><td width="33%" valign="top"><dl>
+  </dl></dd>
 <dt><a href="reference/celery.backends.tyrant.html#celery.backends.tyrant.Backend.get_server">get_server() (celery.backends.tyrant.Backend method)</a></dt>
 <dt><a href="reference/celery.backends.base.html#celery.backends.base.BaseBackend.get_status">get_status() (celery.backends.base.BaseBackend method)</a></dt>
   <dd><dl>
@@ -270,7 +270,6 @@
     <dt><a href="reference/celery.registry.html#celery.registry.TaskRegistry.get_task">(celery.registry.TaskRegistry method)</a></dt>
   </dl></dd>
 <dt><a href="reference/celery.managers.html#celery.managers.PeriodicTaskManager.get_waiting_tasks">get_waiting_tasks() (celery.managers.PeriodicTaskManager method)</a></dt>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.get_worker_pids">get_worker_pids() (celery.datastructures.TaskProcessQueue method)</a></dt>
 </dl></td></tr></table>
 
 <h2 id="I">I</h2>
@@ -312,14 +311,10 @@
 <dt><a href="reference/celery.models.html#PeriodicTaskMeta.last_run_at">last_run_at (PeriodicTaskMeta attribute)</a></dt>
 <dt><a href="reference/celery.timer.html#celery.timer.EventTimer.last_triggered">last_triggered (celery.timer.EventTimer attribute)</a></dt>
 <dt><a href="reference/celery.datastructures.html#celery.datastructures.PositionQueue.length">length (celery.datastructures.PositionQueue attribute)</a></dt>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.limit">limit (celery.datastructures.TaskProcessQueue attribute)</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.LOG_FORMAT">LOG_FORMAT (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.LOG_FORMAT">[1]</a></dt>
 <dt><a href="reference/celery.conf.html#celery.conf.LOG_LEVELS">LOG_LEVELS (in module celery.conf)</a>, <a href="reference/celery.conf.html#celery.conf.LOG_LEVELS">[1]</a></dt></dl></td><td width="33%" valign="top"><dl>
 <dt><a href="reference/celery.worker.html#celery.worker.WorkController.logfile">logfile (celery.worker.WorkController attribute)</a></dt>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.logger">logger (celery.datastructures.TaskProcessQueue attribute)</a></dt>
-  <dd><dl>
-    <dt><a href="reference/celery.worker.html#celery.worker.WorkController.logger">(celery.worker.WorkController attribute)</a></dt>
-  </dl></dd>
+<dt><a href="reference/celery.worker.html#celery.worker.WorkController.logger">logger (celery.worker.WorkController attribute)</a></dt>
 <dt><a href="reference/celery.worker.html#celery.worker.WorkController.loglevel">loglevel (celery.worker.WorkController attribute)</a></dt>
 </dl></td></tr></table>
 
@@ -346,13 +341,6 @@
 <dt><a href="reference/celery.registry.html#celery.registry.NotRegistered">NotRegistered</a></dt>
 </dl></td></tr></table>
 
-<h2 id="O">O</h2>
-<table width="100%" class="indextable"><tr><td width="33%" valign="top">
-<dl>
-
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.on_ready">on_ready() (celery.datastructures.TaskProcessQueue method)</a></dt></dl></td><td width="33%" valign="top"><dl>
-</dl></td></tr></table>
-
 <h2 id="P">P</h2>
 <table width="100%" class="indextable"><tr><td width="33%" valign="top">
 <dl>
@@ -406,6 +394,7 @@
 <dl>
 
 <dt><a href="reference/celery.worker.html#celery.worker.WorkController.schedule_retry_tasks">schedule_retry_tasks() (celery.worker.WorkController method)</a></dt>
+<dt><a href="reference/celery.conf.html#celery.conf.SEND_CELERY_TASK_ERROR_EMAILS">SEND_CELERY_TASK_ERROR_EMAILS (in module celery.conf)</a></dt>
 <dt><a href="reference/celery.log.html#celery.log.setup_logger">setup_logger() (in module celery.log)</a></dt>
 <dt><a href="reference/celery.result.html#celery.result.BaseAsyncResult.status">status (celery.result.BaseAsyncResult attribute)</a></dt>
   <dd><dl>
@@ -448,7 +437,6 @@
 <dt><a href="reference/celery.messaging.html#celery.messaging.TaskConsumer">TaskConsumer (class in celery.messaging)</a></dt>
 <dt><a href="reference/celery.managers.html#celery.managers.TaskManager">TaskManager (class in celery.managers)</a></dt>
 <dt><a href="reference/celery.models.html#TaskMeta">TaskMeta (built-in class)</a></dt></dl></td><td width="33%" valign="top"><dl>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue">TaskProcessQueue (class in celery.datastructures)</a></dt>
 <dt><a href="reference/celery.messaging.html#celery.messaging.TaskPublisher">TaskPublisher (class in celery.messaging)</a></dt>
 <dt><a href="reference/celery.registry.html#celery.registry.TaskRegistry">TaskRegistry (class in celery.registry)</a></dt>
 <dt><a href="reference/celery.registry.html#celery.registry.TaskRegistry.AlreadyRegistered">TaskRegistry.AlreadyRegistered</a></dt>
@@ -485,8 +473,7 @@
 
 <dt><a href="reference/celery.result.html#celery.result.BaseAsyncResult.wait">wait() (celery.result.BaseAsyncResult method)</a></dt>
 <dt><a href="reference/celery.backends.base.html#celery.backends.base.BaseBackend.wait_for">wait_for() (celery.backends.base.BaseBackend method)</a></dt>
-<dt><a href="reference/celery.datastructures.html#celery.datastructures.TaskProcessQueue.wait_for_result">wait_for_result() (celery.datastructures.TaskProcessQueue method)</a></dt></dl></td><td width="33%" valign="top"><dl>
-<dt><a href="reference/celery.worker.html#celery.worker.WorkController">WorkController (class in celery.worker)</a></dt>
+<dt><a href="reference/celery.worker.html#celery.worker.WorkController">WorkController (class in celery.worker)</a></dt></dl></td><td width="33%" valign="top"><dl>
 <dt><a href="reference/celery.platform.html#celery.platform.PIDFile.write">write() (celery.platform.PIDFile method)</a></dt>
 </dl></td></tr></table>
 

+ 6 - 4
index.html

@@ -55,10 +55,10 @@
 <li class="toctree-l2"><a class="reference external" href="introduction.html#api-reference-documentation">API Reference Documentation</a></li>
 <li class="toctree-l2"><a class="reference external" href="introduction.html#installation">Installation</a></li>
 <li class="toctree-l2"><a class="reference external" href="introduction.html#usage">Usage</a><ul>
-<li class="toctree-l3"><a class="reference external" href="introduction.html#defining-tasks">Defining tasks</a></li>
-<li class="toctree-l3"><a class="reference external" href="introduction.html#tell-the-celery-daemon-to-run-a-task">Tell the celery daemon to run a task</a></li>
-<li class="toctree-l3"><a class="reference external" href="introduction.html#execute-a-task-and-get-its-return-value">Execute a task, and get its return value.</a></li>
-<li class="toctree-l3"><a class="reference external" href="introduction.html#running-the-celery-daemon">Running the celery daemon</a></li>
+<li class="toctree-l3"><a class="reference external" href="introduction.html#installing-rabbitmq">Installing RabbitMQ</a></li>
+<li class="toctree-l3"><a class="reference external" href="introduction.html#configuring-your-django-project">Configuring your Django project</a></li>
+<li class="toctree-l3"><a class="reference external" href="introduction.html#running-the-celery-worker-daemon">Running the celery worker daemon</a></li>
+<li class="toctree-l3"><a class="reference external" href="introduction.html#defining-and-executing-tasks">Defining and executing tasks</a></li>
 <li class="toctree-l3"><a class="reference external" href="introduction.html#auto-discovery-of-tasks">Auto-discovery of tasks</a></li>
 <li class="toctree-l3"><a class="reference external" href="introduction.html#periodic-tasks">Periodic Tasks</a></li>
 </ul>
@@ -70,6 +70,8 @@
 <li class="toctree-l2"><a class="reference external" href="faq.html#questions">Questions</a><ul>
 <li class="toctree-l3"><a class="reference external" href="faq.html#mysql-is-throwing-deadlock-errors-what-can-i-do">MySQL is throwing deadlock errors, what can I do?</a></li>
 <li class="toctree-l3"><a class="reference external" href="faq.html#celeryd-is-not-doing-anything-just-hanging">celeryd is not doing anything, just hanging</a></li>
+<li class="toctree-l3"><a class="reference external" href="faq.html#i-m-having-integrityerror-duplicate-key-errors-why">I&#8217;m having <tt class="docutils literal"><span class="pre">IntegrityError:</span> <span class="pre">Duplicate</span> <span class="pre">Key</span></tt> errors. Why?</a></li>
+<li class="toctree-l3"><a class="reference external" href="faq.html#my-periodic-tasks-won-t-run">My Periodic Tasks won&#8217;t run</a></li>
 <li class="toctree-l3"><a class="reference external" href="faq.html#can-i-send-some-tasks-to-only-some-servers">Can I send some tasks to only some servers?</a></li>
 </ul>
 </li>

+ 81 - 62
introduction.html

@@ -124,85 +124,102 @@ by doing the following,:</p>
 </div>
 <div class="section" id="usage">
 <h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
-<p>Have to write a cool tutorial, but here is some simple usage info.</p>
-<p><em>Note</em> You need to have a AMQP message broker running, like <a class="reference external" href="http://www.rabbitmq.com">RabbitMQ</a>,
-and you need to have the amqp server setup in your settings file, as described
-in the <a class="reference external" href="http://pypi.python.org/pypi/carrot/0.3.3">carrot distribution README</a>.</p>
-<p><em>Note</em> If you&#8217;re running <tt class="docutils literal"><span class="pre">SQLite</span></tt> as the database back-end, <tt class="docutils literal"><span class="pre">celeryd</span></tt> will
-only be able to process one message at a time, this is because <tt class="docutils literal"><span class="pre">SQLite</span></tt>
-doesn&#8217;t allow concurrent writes.</p>
-<div class="section" id="defining-tasks">
-<h3>Defining tasks<a class="headerlink" href="#defining-tasks" title="Permalink to this headline">¶</a></h3>
-<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">tasks</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.log</span> <span class="kn">import</span> <span class="n">setup_logger</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="k">def</span> <span class="nf">do_something</span><span class="p">(</span><span class="n">some_arg</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
-<span class="gp">... </span>    <span class="n">logger</span> <span class="o">=</span> <span class="n">setup_logger</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
-<span class="gp">... </span>    <span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Did something: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">some_arg</span><span class="p">)</span>
-<span class="gp">... </span>    <span class="k">return</span> <span class="mf">42</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">task</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">do_something</span><span class="p">,</span> <span class="s">&quot;do_something&quot;</span><span class="p">)</span>
-</pre></div>
+<div class="section" id="installing-rabbitmq">
+<h3>Installing RabbitMQ<a class="headerlink" href="#installing-rabbitmq" title="Permalink to this headline">¶</a></h3>
+</div>
+<div class="section" id="configuring-your-django-project">
+<h3>Configuring your Django project<a class="headerlink" href="#configuring-your-django-project" title="Permalink to this headline">¶</a></h3>
+</div>
+<div class="section" id="running-the-celery-worker-daemon">
+<h3>Running the celery worker daemon<a class="headerlink" href="#running-the-celery-worker-daemon" title="Permalink to this headline">¶</a></h3>
+<p>To test this we&#8217;ll be running the worker daemon in the foreground, so we can
+see what&#8217;s going on without consulting the logfile:</p>
+<div class="highlight-python"><pre>::</pre>
+</div>
+<blockquote>
+$ python manage.py celeryd</blockquote>
+<p>However, in production you&#8217;ll probably want to run the worker in the
+background as daemon instead:</p>
+<div class="highlight-python"><pre>$ python manage.py celeryd --daemon</pre>
 </div>
+<p>For help on command line arguments to the worker daemon, you can execute the
+help command:</p>
+<div class="highlight-python"><pre>$ python manage.py help celeryd</pre>
 </div>
-<div class="section" id="tell-the-celery-daemon-to-run-a-task">
-<h3>Tell the celery daemon to run a task<a class="headerlink" href="#tell-the-celery-daemon-to-run-a-task" title="Permalink to this headline">¶</a></h3>
-<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">delay_task</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">delay_task</span><span class="p">(</span><span class="s">&quot;do_something&quot;</span><span class="p">,</span> <span class="n">some_arg</span><span class="o">=</span><span class="s">&quot;foo bar baz&quot;</span><span class="p">)</span>
+<p><strong>Note</strong>: If you&#8217;re using <tt class="docutils literal"><span class="pre">SQLite</span></tt> as the Django database back-end,
+<tt class="docutils literal"><span class="pre">celeryd</span></tt> will only be able to process one task at a time, this is
+because <tt class="docutils literal"><span class="pre">SQLite</span></tt> doesn&#8217;t allow concurrent writes.</p>
+</div>
+<div class="section" id="defining-and-executing-tasks">
+<h3>Defining and executing tasks<a class="headerlink" href="#defining-and-executing-tasks" title="Permalink to this headline">¶</a></h3>
+<p><strong>Please note</strong> All of these tasks has to be stored in a real module, they can&#8217;t
+be defined in the python shell or ipython/bpython. This is because the celery
+worker server needs access to the task function to be able to run it.
+So while it looks like we use the python shell to define the tasks in these
+examples, you can&#8217;t do it this way. Put them in your Django applications
+<tt class="docutils literal"><span class="pre">tasks</span></tt> module (the worker daemon will automatically load any <tt class="docutils literal"><span class="pre">tasks.py</span></tt>
+file for all of the applications listed in <tt class="docutils literal"><span class="pre">settings.INSTALLED_APPS</span></tt>.
+Execution tasks using <tt class="docutils literal"><span class="pre">delay</span></tt> and <tt class="docutils literal"><span class="pre">apply_async</span></tt> can be done from the
+python shell, but keep in mind that since arguments are pickled, you can&#8217;t
+use custom classes defined in the shell session.</p>
+<p>While you can use regular functions, the recommended way is creating
+a task class, this way you can cleanly upgrade the task to use the more
+advanced features of celery later.</p>
+<p>This is a task that basically does nothing but take some arguments,
+and return value:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyTask</span><span class="p">(</span><span class="n">Task</span><span class="p">):</span>
+<span class="gp">... </span>    <span class="n">name</span> <span class="o">=</span> <span class="s">&quot;myapp.mytask&quot;</span>
+<span class="gp">... </span>    <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">some_arg</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
+<span class="gp">... </span>        <span class="n">logger</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_logger</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
+<span class="gp">... </span>        <span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Did something: </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span> <span class="n">some_arg</span><span class="p">)</span>
+<span class="gp">... </span>        <span class="k">return</span> <span class="mf">42</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">tasks</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">MyTask</span><span class="p">)</span>
 </pre></div>
 </div>
+<p>Now if we want to execute this task, we can use the <tt class="docutils literal"><span class="pre">delay</span></tt> method of the
+task class (this is a handy shortcut to the <tt class="docutils literal"><span class="pre">apply_async</span></tt> method which gives
+you greater control of the task execution).</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">myapp.tasks</span> <span class="kn">import</span> <span class="n">MyTask</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">MyTask</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="n">some_arg</span><span class="o">=</span><span class="s">&quot;foo&quot;</span><span class="p">)</span>
+</pre></div>
 </div>
-<div class="section" id="execute-a-task-and-get-its-return-value">
-<h3>Execute a task, and get its return value.<a class="headerlink" href="#execute-a-task-and-get-its-return-value" title="Permalink to this headline">¶</a></h3>
-<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">delay_task</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span> <span class="o">=</span> <span class="n">delay_task</span><span class="p">(</span><span class="s">&quot;do_something&quot;</span><span class="p">,</span> <span class="n">some_arg</span><span class="o">=</span><span class="s">&quot;foo bar baz&quot;</span><span class="p">)</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">ready</span><span class="p">()</span>
+<p>At this point, the task has been sent to the message broker. The message
+broker will hold on to the task until a celery worker server has successfully
+picked it up.</p>
+<p>Now the task has been executed, but to know what happened with the task we
+have to check the celery logfile to see its return value and output.
+This is because we didn&#8217;t keep the <tt class="docutils literal"><span class="pre">AsyncResult</span></tt> object returned by
+<tt class="docutils literal"><span class="pre">delay</span></tt>.</p>
+<p>The <tt class="docutils literal"><span class="pre">AsyncResult</span></tt> lets us find out the state of the task, wait for the task to
+finish and get its return value (or exception if the task failed).</p>
+<p>So, let&#8217;s execute the task again, but this time we&#8217;ll keep track of the task:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">result</span> <span class="o">=</span> <span class="n">MyTask</span><span class="o">.</span><span class="n">delay</span><span class="p">(</span><span class="s">&quot;do_something&quot;</span><span class="p">,</span> <span class="n">some_arg</span><span class="o">=</span><span class="s">&quot;foo bar baz&quot;</span><span class="p">)</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">ready</span><span class="p">()</span> <span class="c"># returns True if the task has finished processing.</span>
 <span class="go">False</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>   <span class="c"># Waits until the task is done.</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">result</span> <span class="c"># task is not ready, so no return value yet.</span>
+<span class="go">None</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">get</span><span class="p">()</span>   <span class="c"># Waits until the task is done and return the retval.</span>
 <span class="go">42</span>
-<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">status</span><span class="p">()</span>
-<span class="go">&#39;DONE&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">result</span>
+<span class="go">42</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">result</span><span class="o">.</span><span class="n">success</span><span class="p">()</span> <span class="c"># returns True if the task didn&#39;t end in failure.</span>
+<span class="go">True</span>
 </pre></div>
 </div>
-<p>If the task raises an exception, the tasks status will be <tt class="docutils literal"><span class="pre">FAILURE</span></tt>, and
-<tt class="docutils literal"><span class="pre">result.result</span></tt> will contain the exception instance raised.</p>
-</div>
-<div class="section" id="running-the-celery-daemon">
-<h3>Running the celery daemon<a class="headerlink" href="#running-the-celery-daemon" title="Permalink to this headline">¶</a></h3>
-<div class="highlight-python"><pre>$ cd mydjangoproject
-$ env DJANGO_SETTINGS_MODULE=settings celeryd
-[....]
-[2009-04-23 17:44:05,115: INFO/Process-1] Did something: foo bar baz
-[2009-04-23 17:44:05,118: INFO/MainProcess] Waiting for queue.</pre>
-</div>
+<p>If the task raises an exception, the <tt class="docutils literal"><span class="pre">result.success()</span></tt> will be <tt class="xref docutils literal"><span class="pre">False</span></tt>,
+and <tt class="docutils literal"><span class="pre">result.result</span></tt> will contain the exception instance raised.</p>
 </div>
 <div class="section" id="auto-discovery-of-tasks">
 <h3>Auto-discovery of tasks<a class="headerlink" href="#auto-discovery-of-tasks" title="Permalink to this headline">¶</a></h3>
 <p><tt class="docutils literal"><span class="pre">celery</span></tt> has an auto-discovery feature like the Django Admin, that
 automatically loads any <tt class="docutils literal"><span class="pre">tasks.py</span></tt> module in the applications listed
-in <tt class="docutils literal"><span class="pre">settings.INSTALLED_APPS</span></tt>.</p>
-<p>A good place to add this command could be in your <tt class="docutils literal"><span class="pre">urls.py</span></tt>,</p>
-<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">tasks</span>
-<span class="n">tasks</span><span class="o">.</span><span class="n">autodiscover</span><span class="p">()</span>
-</pre></div>
-</div>
-<p>Then you can add new tasks in your applications <tt class="docutils literal"><span class="pre">tasks.py</span></tt> module,</p>
-<div class="highlight-python"><pre>from celery.task import tasks
-from celery.log import setup_logger
-from clickcounter.models import ClickCount
-
-def increment_click(for_url, **kwargs):
-    logger = setup_logger(**kwargs)
-    clicks_for_url, cr = ClickCount.objects.get_or_create(url=for_url)
-    clicks_for_url.clicks = clicks_for_url.clicks + 1
-    clicks_for_url.save()
-    logger.info("Incremented click count for %s (not at %d)" % (
-                    for_url, clicks_for_url.clicks)
-tasks.register(increment_click, "increment_click")</pre>
-</div>
+in <tt class="docutils literal"><span class="pre">settings.INSTALLED_APPS</span></tt>. This autodiscovery is used by the celery
+worker to find registered tasks for your Django project.</p>
 </div>
 <div class="section" id="periodic-tasks">
 <h3>Periodic Tasks<a class="headerlink" href="#periodic-tasks" title="Permalink to this headline">¶</a></h3>
-<p>Periodic tasks are tasks that are run every <tt class="docutils literal"><span class="pre">n</span></tt> seconds. They don&#8217;t
-support extra arguments. Here&#8217;s an example of a periodic task:</p>
+<p>Periodic tasks are tasks that are run every <tt class="docutils literal"><span class="pre">n</span></tt> seconds.
+Here&#8217;s an example of a periodic task:</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">celery.task</span> <span class="kn">import</span> <span class="n">tasks</span><span class="p">,</span> <span class="n">PeriodicTask</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">timedelta</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyPeriodicTask</span><span class="p">(</span><span class="n">PeriodicTask</span><span class="p">):</span>
@@ -216,6 +233,8 @@ support extra arguments. Here&#8217;s an example of a periodic task:</p>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">tasks</span><span class="o">.</span><span class="n">register</span><span class="p">(</span><span class="n">MyPeriodicTask</span><span class="p">)</span>
 </pre></div>
 </div>
+<p><strong>Note:</strong> Periodic tasks does not support arguments, as this doesn&#8217;t
+really make sense.</p>
 <p>For periodic tasks to work you need to add <tt class="docutils literal"><span class="pre">celery</span></tt> to <tt class="docutils literal"><span class="pre">INSTALLED_APPS</span></tt>,
 and issue a <tt class="docutils literal"><span class="pre">syncdb</span></tt>.</p>
 </div>

+ 13 - 18
objects.inv

@@ -36,15 +36,15 @@ TASK_STATUS_FAILURE data reference/celery.models.html
 celery.task.execute_remote function reference/celery.task.html
 celery.result.BaseAsyncResult.backend attribute reference/celery.result.html
 celery.worker.TaskWrapper class reference/celery.worker.html
+celery.messaging.TaskPublisher.encoder method reference/celery.messaging.html
 celery.datastructures.PositionQueue.full method reference/celery.datastructures.html
 celery.discovery.find_related_module function reference/celery.discovery.html
-celery.task.TaskSet.join method reference/celery.task.html
+celery.worker.WorkController.logfile attribute reference/celery.worker.html
 celery.result.BaseAsyncResult.ready method reference/celery.result.html
 celery.worker.EmptyQueue exception reference/celery.worker.html
 celery.registry.TaskRegistry.AlreadyRegistered exception reference/celery.registry.html
 celery.managers.TaskManager.delete_expired method reference/celery.managers.html
 celery.registry.TaskRegistry.filter_types method reference/celery.registry.html
-celery.worker.jail function reference/celery.worker.html
 celery.backends.base.UnpickleableExceptionWrapper.exc_args attribute reference/celery.backends.base.html
 celery.backends.tyrant.Backend class reference/celery.backends.tyrant.html
 celery.worker.WorkController.pool attribute reference/celery.worker.html
@@ -66,7 +66,7 @@ celery.platform.PIDFile.get_pid method reference/celery.platform.html
 celery.task.Task.run method reference/celery.task.html
 celery.result.BaseAsyncResult class reference/celery.result.html
 celery.platform.PIDFile.check method reference/celery.platform.html
-celery.conf.LOG_FORMAT data reference/celery.conf.html
+TASK_STATUS_RETRY data reference/celery.models.html
 celery.backends.database.Backend.store_result method reference/celery.backends.database.html
 celery.task.TaskSet.map_async classmethod reference/celery.task.html
 celery.platform.PIDFile.remove method reference/celery.platform.html
@@ -76,6 +76,7 @@ celery.conf.EMPTY_MSG_EMIT_EVERY data reference/celery.conf.html
 celery.backends.base.BaseBackend.wait_for method reference/celery.backends.base.html
 celery.task.Task.name attribute reference/celery.task.html
 celery.backends.base.BaseBackend.mark_as_done method reference/celery.backends.base.html
+celery.conf.DEFAULT_DAEMON_LOG_FILE data reference/celery.conf.html
 celery.registry.TaskRegistry.get_all_periodic method reference/celery.registry.html
 PeriodicTaskMeta.last_run_at attribute reference/celery.models.html
 celery.task.Task.get_publisher method reference/celery.task.html
@@ -89,26 +90,25 @@ celery.conf.AMQP_CONSUMER_ROUTING_KEY data reference/celery.conf.html
 celery.backends.base.BaseBackend class reference/celery.backends.base.html
 celery.conf.AMQP_EXCHANGE_TYPE data reference/celery.conf.html
 celery.worker.WorkController class reference/celery.worker.html
-celery.task.TaskSet.remote_execute classmethod reference/celery.task.html
+celery.backends.base.BaseBackend.mark_as_failure method reference/celery.backends.base.html
 celery.backends.tyrant.Backend.get_status method reference/celery.backends.tyrant.html
 celery.registry.TaskRegistry.NotRegistered exception reference/celery.registry.html
 celery.datastructures.PositionQueue.length attribute reference/celery.datastructures.html
 celery.datastructures.PositionQueue class reference/celery.datastructures.html
-celery.datastructures.TaskProcessQueue.wait_for_result method reference/celery.datastructures.html
 celery.backends.base.BaseBackend.prepare_result method reference/celery.backends.base.html
-celery.datastructures.TaskProcessQueue class reference/celery.datastructures.html
 celery.backends.base.BaseBackend.UnpickleableExceptionWrapper.exc_module attribute reference/celery.backends.base.html
 celery.task.ExecuteRemoteTask class reference/celery.task.html
 celery.task.dmap_async function reference/celery.task.html
 celery.worker.WorkController.connection_diagnostics method reference/celery.worker.html
 celery.managers.TaskManager class reference/celery.managers.html
 celery.backends.base.BaseBackend.store_result method reference/celery.backends.base.html
-celery.datastructures.TaskProcessQueue.logger attribute reference/celery.datastructures.html
+celery.worker.jail function reference/celery.worker.html
+celery.task.TaskSet.remote_execute classmethod reference/celery.task.html
 celery.result.AsyncResult.task_id attribute reference/celery.result.html
 celery.timer.EventTimer.interval attribute reference/celery.timer.html
 celery.result.BaseAsyncResult.successful method reference/celery.result.html
 celery.backends.tyrant.Backend.get_server method reference/celery.backends.tyrant.html
-TASK_STATUS_RETRY data reference/celery.models.html
+celery.conf.LOG_FORMAT data reference/celery.conf.html
 TASK_STATUSES data reference/celery.models.html
 celery.managers.TaskManager.get_task method reference/celery.managers.html
 celery.conf.AMQP_EXCHANGE data reference/celery.conf.html
@@ -120,7 +120,6 @@ celery.conf.DAEMON_LOG_LEVEL data reference/celery.conf.html
 celery.backends.database.Backend class reference/celery.backends.database.html
 celery.result.BaseAsyncResult.status attribute reference/celery.result.html
 celery.worker.TaskWrapper.kwargs attribute reference/celery.worker.html
-celery.datastructures.TaskProcessQueue.limit attribute reference/celery.datastructures.html
 celery.conf.QUEUE_WAKEUP_AFTER data reference/celery.conf.html
 celery.backends.database.Backend.get_result method reference/celery.backends.database.html
 celery.backends.get_backend_cls function reference/celery.backends.html
@@ -132,7 +131,6 @@ celery.backends.cache.Backend.get_result method reference/celery.backends.cache.
 celery.task.Task.get_logger method reference/celery.task.html
 celery.conf.DAEMON_LOG_FILE data reference/celery.conf.html
 celery.backends.base.find_nearest_pickleable_exception function reference/celery.backends.base.html
-celery.datastructures.TaskProcessQueue.add method reference/celery.datastructures.html
 celery.task.PeriodicTask class reference/celery.task.html
 celery.registry.TaskRegistry.unregister method reference/celery.registry.html
 celery.backends.base.BaseBackend.UnpickleableExceptionWrapper.exc_args attribute reference/celery.backends.base.html
@@ -147,7 +145,6 @@ celery.worker.TaskWrapper.extend_with_default_kwargs method reference/celery.wor
 celery.worker.WorkController.execute_next_task method reference/celery.worker.html
 celery.result.BaseAsyncResult.task_id attribute reference/celery.result.html
 celery.backends.cache.Backend.is_done method reference/celery.backends.cache.html
-celery.worker.WorkController.logfile attribute reference/celery.worker.html
 celery.task.Task.get_consumer method reference/celery.task.html
 celery.messaging.TaskPublisher.delay_task_in_set method reference/celery.messaging.html
 celery.backends.base.BaseBackend.UnpickleableExceptionWrapper exception reference/celery.backends.base.html
@@ -156,9 +153,9 @@ celery.platform.remove_pidfile function reference/celery.platform.html
 celery.platform.PIDFile class reference/celery.platform.html
 celery.worker.TaskWrapper.task_id attribute reference/celery.worker.html
 celery.managers.PeriodicTaskManager.get_waiting_tasks method reference/celery.managers.html
-celery.backends.base.BaseBackend.mark_as_failure method reference/celery.backends.base.html
+celery.messaging.TaskPublisher.delay_task method reference/celery.messaging.html
 celery.worker.WorkController.loglevel attribute reference/celery.worker.html
-celery.datastructures.TaskProcessQueue.done_msg attribute reference/celery.datastructures.html
+celery.task.TaskSet.join method reference/celery.task.html
 celery.worker.WorkController.queue_wakeup_after attribute reference/celery.worker.html
 celery.registry.TaskRegistry.get_all_regular method reference/celery.registry.html
 celery.worker.WorkController.run method reference/celery.worker.html
@@ -168,9 +165,7 @@ celery.worker.UnknownTask exception reference/celery.worker.html
 celery.timer.TimeoutTimer class reference/celery.timer.html
 celery.backends.get_default_periodicstatus_backend_cls function reference/celery.backends.html
 celery.result.BaseAsyncResult.wait method reference/celery.result.html
-celery.datastructures.TaskProcessQueue.on_ready method reference/celery.datastructures.html
 celery.task.TaskSet.run method reference/celery.task.html
-celery.messaging.TaskPublisher.delay_task method reference/celery.messaging.html
 celery.backends.base.BaseBackend.UnpickleableExceptionWrapper.exc_cls_name attribute reference/celery.backends.base.html
 celery.result.AsyncResult.backend attribute reference/celery.result.html
 celery.task.apply_async function reference/celery.task.html
@@ -197,7 +192,7 @@ celery.task.PeriodicTask.run_every attribute reference/celery.task.html
 celery.conf.LOG_LEVELS data reference/celery.conf.html
 celery.managers.TaskManager.is_done method reference/celery.managers.html
 celery.timer.EventTimer.tick method reference/celery.timer.html
-celery.conf.DEFAULT_REAP_TIMEOUT data reference/celery.conf.html
+celery.messaging.TaskConsumer.decoder method reference/celery.messaging.html
 celery.task.Task.delay classmethod reference/celery.task.html
 celery.backends.cache.Backend.get_status method reference/celery.backends.cache.html
 celery.log.setup_logger function reference/celery.log.html
@@ -206,7 +201,6 @@ celery.conf.DAEMON_CONCURRENCY data reference/celery.conf.html
 celery.worker.WorkController.logger attribute reference/celery.worker.html
 celery.registry.TaskRegistry.get_all method reference/celery.registry.html
 celery.backends.tyrant.Backend.store_result method reference/celery.backends.tyrant.html
-celery.datastructures.TaskProcessQueue.get_worker_pids method reference/celery.datastructures.html
 celery.timer.TimeoutTimer.tick method reference/celery.timer.html
 TASK_STATUS_PENDING data reference/celery.models.html
 celery.registry.TaskRegistry.get_task method reference/celery.registry.html
@@ -227,5 +221,6 @@ celery.platform.daemonize function reference/celery.platform.html
 celery.managers.TaskManager.store_result method reference/celery.managers.html
 TaskMeta.result attribute reference/celery.models.html
 celery.timer.TimeoutTimer.time_start attribute reference/celery.timer.html
-celery.worker.TaskWrapper.task_name attribute reference/celery.worker.html
 celery.task.TaskSet.arguments attribute reference/celery.task.html
+celery.worker.TaskWrapper.task_name attribute reference/celery.worker.html
+celery.conf.SEND_CELERY_TASK_ERROR_EMAILS data reference/celery.conf.html

+ 16 - 5
reference/celery.conf.html

@@ -52,12 +52,23 @@
   <div class="section" id="module-celery.conf">
 <h1>Configuration - celery.conf<a class="headerlink" href="#module-celery.conf" title="Permalink to this headline">¶</a></h1>
 <p>celery.conf</p>
+<dl class="data">
+<dt id="celery.conf.AMQP_CONSUMER_QUEUE">
+<tt class="descclassname">celery.conf.</tt><tt class="descname">AMQP_CONSUMER_QUEUE</tt><a class="headerlink" href="#celery.conf.AMQP_CONSUMER_QUEUE" title="Permalink to this definition">¶</a></dt>
+<dd><dl class="data">
+<dt id="celery.conf.SEND_CELERY_TASK_ERROR_EMAILS">
+<tt class="descclassname">celery.conf.</tt><tt class="descname">SEND_CELERY_TASK_ERROR_EMAILS</tt><a class="headerlink" href="#celery.conf.SEND_CELERY_TASK_ERROR_EMAILS" title="Permalink to this definition">¶</a></dt>
+<dd>If set to <tt class="xref docutils literal"><span class="pre">True</span></tt>, errors in tasks will be sent to admins by e-mail.
+If unset, it will send the e-mails if DEBUG is False.</dd></dl>
+
+</dd></dl>
+
 <dl class="data">
 <dt id="celery.conf.AMQP_CONSUMER_ROUTING_KEY">
 <tt class="descclassname">celery.conf.</tt><tt class="descname">AMQP_CONSUMER_ROUTING_KEY</tt><a class="headerlink" href="#celery.conf.AMQP_CONSUMER_ROUTING_KEY" title="Permalink to this definition">¶</a></dt>
 <dd><dl class="data">
-<dt id="celery.conf.AMQP_CONSUMER_QUEUE">
-<tt class="descclassname">celery.conf.</tt><tt class="descname">AMQP_CONSUMER_QUEUE</tt><a class="headerlink" href="#celery.conf.AMQP_CONSUMER_QUEUE" title="Permalink to this definition">¶</a></dt>
+<dt>
+<tt class="descclassname">celery.conf.</tt><tt class="descname">AMQP_CONSUMER_QUEUE</tt></dt>
 <dd>The name of the AMQP queue.</dd></dl>
 
 </dd></dl>
@@ -72,7 +83,7 @@
 
 <p>The type of exchange. If the exchange type is <tt class="docutils literal"><span class="pre">direct</span></tt>, all messages
 receives all tasks. However, if the exchange type is <tt class="docutils literal"><span class="pre">topic</span></tt>, you can
-route e.g some tasks to one server, and others to the rest.
+route e.g. some tasks to one server, and others to the rest.
 See <a href="#id1"><span class="problematic" id="id2">`Exchange types and the effect of bindings`_</span></a>.</p>
 </dd></dl>
 
@@ -141,8 +152,8 @@ wakes up and checks the queue again.</dd></dl>
 </dd></dl>
 
 <dl class="data">
-<dt id="celery.conf.DEFAULT_REAP_TIMEOUT">
-<tt class="descclassname">celery.conf.</tt><tt class="descname">DEFAULT_REAP_TIMEOUT</tt><a class="headerlink" href="#celery.conf.DEFAULT_REAP_TIMEOUT" title="Permalink to this definition">¶</a></dt>
+<dt id="celery.conf.DEFAULT_DAEMON_LOG_FILE">
+<tt class="descclassname">celery.conf.</tt><tt class="descname">DEFAULT_DAEMON_LOG_FILE</tt><a class="headerlink" href="#celery.conf.DEFAULT_DAEMON_LOG_FILE" title="Permalink to this definition">¶</a></dt>
 <dd><dl class="data">
 <dt id="celery.conf.LOG_LEVELS">
 <tt class="descclassname">celery.conf.</tt><tt class="descname">LOG_LEVELS</tt><a class="headerlink" href="#celery.conf.LOG_LEVELS" title="Permalink to this definition">¶</a></dt>

+ 0 - 108
reference/celery.datastructures.html

@@ -90,114 +90,6 @@ class </em><tt class="descname">UnfilledPosition</tt><big>(</big><em>position</e
 
 </dd></dl>
 
-<dl class="class">
-<dt id="celery.datastructures.TaskProcessQueue">
-<em class="property">
-class </em><tt class="descclassname">celery.datastructures.</tt><tt class="descname">TaskProcessQueue</tt><big>(</big><em>limit</em>, <em>reap_timeout=None</em>, <em>logger=None</em>, <em>done_msg=None</em><big>)</big><a class="headerlink" href="#celery.datastructures.TaskProcessQueue" title="Permalink to this definition">¶</a></dt>
-<dd><p>Queue of running child processes, which starts waiting for the
-processes to finish when the queue limit has been reached.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><em>limit</em> &#8211; see <a title="celery.datastructures.TaskProcessQueue.limit" class="reference internal" href="#celery.datastructures.TaskProcessQueue.limit"><tt class="xref docutils literal"><span class="pre">limit</span></tt></a> attribute.</li>
-<li><em>logger</em> &#8211; see <a title="celery.datastructures.TaskProcessQueue.logger" class="reference internal" href="#celery.datastructures.TaskProcessQueue.logger"><tt class="xref docutils literal"><span class="pre">logger</span></tt></a> attribute.</li>
-<li><em>done_msg</em> &#8211; see <a title="celery.datastructures.TaskProcessQueue.done_msg" class="reference internal" href="#celery.datastructures.TaskProcessQueue.done_msg"><tt class="xref docutils literal"><span class="pre">done_msg</span></tt></a> attribute.</li>
-</ul>
-</td>
-</tr>
-</tbody>
-</table>
-<dl class="attribute">
-<dt id="celery.datastructures.TaskProcessQueue.limit">
-<tt class="descname">limit</tt><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.limit" title="Permalink to this definition">¶</a></dt>
-<dd>The number of processes that can run simultaneously until
-we start collecting results.</dd></dl>
-
-<dl class="attribute">
-<dt id="celery.datastructures.TaskProcessQueue.logger">
-<tt class="descname">logger</tt><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.logger" title="Permalink to this definition">¶</a></dt>
-<dd>The logger used to print the <a title="celery.datastructures.TaskProcessQueue.done_msg" class="reference internal" href="#celery.datastructures.TaskProcessQueue.done_msg"><tt class="xref docutils literal"><span class="pre">done_msg</span></tt></a>.</dd></dl>
-
-<dl class="attribute">
-<dt id="celery.datastructures.TaskProcessQueue.done_msg">
-<tt class="descname">done_msg</tt><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.done_msg" title="Permalink to this definition">¶</a></dt>
-<dd>Message logged when a tasks result has been collected.
-The message is logged with loglevel <tt class="xref docutils literal"><span class="pre">logging.INFO</span></tt>.</dd></dl>
-
-<dl class="method">
-<dt id="celery.datastructures.TaskProcessQueue.add">
-<tt class="descname">add</tt><big>(</big><em>result</em>, <em>task_name</em>, <em>task_id</em><big>)</big><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.add" title="Permalink to this definition">¶</a></dt>
-<dd><p>Add a process to the queue.</p>
-<p>If the queue is full, it will wait for the first task to finish,
-collects its result and remove it from the queue, so it&#8217;s ready
-to accept new processes.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
-<li><em>result</em> &#8211; A <tt class="xref docutils literal"><span class="pre">multiprocessing.AsyncResult</span></tt> instance, as
-returned by <tt class="xref docutils literal"><span class="pre">multiprocessing.Pool.apply_async()</span></tt>.</li>
-<li><em>task_name</em> &#8211; Name of the task executed.</li>
-<li><em>task_id</em> &#8211; Id of the task executed.</li>
-</ul>
-</td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
-<dl class="method">
-<dt id="celery.datastructures.TaskProcessQueue.get_worker_pids">
-<tt class="descname">get_worker_pids</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.get_worker_pids" title="Permalink to this definition">¶</a></dt>
-<dd><p>Returns the process id&#8217;s of all the pool workers.</p>
-<table class="docutils field-list" frame="void" rules="none">
-<col class="field-name" />
-<col class="field-body" />
-<tbody valign="top">
-<tr class="field"><th class="field-name">Return type:</th><td class="field-body">list</td>
-</tr>
-</tbody>
-</table>
-</dd></dl>
-
-<dl class="method">
-<dt id="celery.datastructures.TaskProcessQueue.on_ready">
-<tt class="descname">on_ready</tt><big>(</big><em>ret_value</em>, <em>task_name</em>, <em>task_id</em><big>)</big><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.on_ready" title="Permalink to this definition">¶</a></dt>
-<dd><p>What to do when a worker returns with a result.</p>
-<p>If <a title="celery.datastructures.TaskProcessQueue.done_msg" class="reference internal" href="#celery.datastructures.TaskProcessQueue.done_msg"><tt class="xref docutils literal"><span class="pre">done_msg</span></tt></a> is defined, it will log this
-format string, with level <tt class="docutils literal"><span class="pre">logging.INFO</span></tt>,
-using these format variables:</p>
-<ul>
-<li><p class="first">%(name)</p>
-<blockquote>
-<p>The name of the task completed</p>
-</blockquote>
-</li>
-<li><p class="first">%(id)</p>
-<blockquote>
-<p>The UUID of the task completed.</p>
-</blockquote>
-</li>
-<li><p class="first">%(return_value)</p>
-<blockquote>
-<p>Return value of the task function.</p>
-</blockquote>
-</li>
-</ul>
-</dd></dl>
-
-<dl class="method">
-<dt id="celery.datastructures.TaskProcessQueue.wait_for_result">
-<tt class="descname">wait_for_result</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.datastructures.TaskProcessQueue.wait_for_result" title="Permalink to this definition">¶</a></dt>
-<dd><p>Waits for the first process in the pool to finish.</p>
-<p>This operation is blocking.</p>
-</dd></dl>
-
-</dd></dl>
-
 </div>
 
 

+ 14 - 1
reference/celery.messaging.html

@@ -63,7 +63,13 @@ it doesn&#8217;t support <tt class="xref docutils literal"><span class="pre">car
 <dt id="celery.messaging.TaskConsumer">
 <em class="property">
 class </em><tt class="descclassname">celery.messaging.</tt><tt class="descname">TaskConsumer</tt><big>(</big><em>connection</em>, <em>queue=None</em>, <em>exchange=None</em>, <em>routing_key=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.messaging.TaskConsumer" title="Permalink to this definition">¶</a></dt>
-<dd>The AMQP Task Consumer class.</dd></dl>
+<dd><p>The AMQP Task Consumer class.</p>
+<dl class="method">
+<dt id="celery.messaging.TaskConsumer.decoder">
+<tt class="descname">decoder</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.messaging.TaskConsumer.decoder" title="Permalink to this definition">¶</a></dt>
+<dd>loads(string) &#8211; Load a pickle from the given string</dd></dl>
+
+</dd></dl>
 
 <dl class="class">
 <dt id="celery.messaging.TaskPublisher">
@@ -80,6 +86,13 @@ class </em><tt class="descclassname">celery.messaging.</tt><tt class="descname">
 <tt class="descname">delay_task_in_set</tt><big>(</big><em>task_name</em>, <em>taskset_id</em>, <em>task_args</em>, <em>task_kwargs</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.messaging.TaskPublisher.delay_task_in_set" title="Permalink to this definition">¶</a></dt>
 <dd>Delay a task which part of a task set.</dd></dl>
 
+<dl class="method">
+<dt id="celery.messaging.TaskPublisher.encoder">
+<tt class="descname">encoder</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.messaging.TaskPublisher.encoder" title="Permalink to this definition">¶</a></dt>
+<dd><p>dumps(obj, protocol=0) &#8211; Return a string containing an object in pickle format.</p>
+<p>See the Pickler docstring for the meaning of optional argument proto.</p>
+</dd></dl>
+
 <dl class="method">
 <dt id="celery.messaging.TaskPublisher.requeue_task">
 <tt class="descname">requeue_task</tt><big>(</big><em>task_name</em>, <em>task_id</em>, <em>task_args</em>, <em>task_kwargs</em>, <em>part_of_set=None</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#celery.messaging.TaskPublisher.requeue_task" title="Permalink to this definition">¶</a></dt>

+ 3 - 1
reference/celery.registry.html

@@ -120,7 +120,9 @@ from <a title="celery.task.Task" class="reference external" href="celery.task.ht
 <col class="field-name" />
 <col class="field-body" />
 <tbody valign="top">
-<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>task_name</em> &#8211; Required if the task is a regular function.</td>
+<tr class="field"><th class="field-name">Parameter:</th><td class="field-body"><em>task_name</em> &#8211; By default the <tt class="xref docutils literal"><span class="pre">Task.name</span></tt> attribute on the
+task is used as the name of the task, but you can override it
+using this option.</td>
 </tr>
 <tr class="field"><th class="field-name" colspan="2">Raises <a title="celery.registry.AlreadyRegistered" class="reference internal" href="#celery.registry.AlreadyRegistered">AlreadyRegistered</a>:</th></tr>
 <tr><td>&nbsp;</td><td class="field-body">if the task is already registered.</td>

+ 2 - 2
reference/celery.task.html

@@ -255,7 +255,7 @@ classmethod </em><tt class="descname">delay</tt><big>(</big><em>*args</em>, <em>
 </tbody>
 </table>
 <p>Please be sure to close the AMQP connection when you&#8217;re done
-with this object. i.e:</p>
+with this object. i.e.:</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">consumer</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_consumer</span><span class="p">()</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="c"># do something with consumer</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">consumer</span><span class="o">.</span><span class="n">connection</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
@@ -283,7 +283,7 @@ with this object. i.e:</p>
 </tbody>
 </table>
 <p>Please be sure to close the AMQP connection when you&#8217;re done
-with this object, i.e:</p>
+with this object, i.e.:</p>
 <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">publisher</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_publisher</span><span class="p">()</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="c"># do something with publisher</span>
 <span class="gp">&gt;&gt;&gt; </span><span class="n">publisher</span><span class="o">.</span><span class="n">connection</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>

+ 2 - 2
reference/celery.worker.html

@@ -61,7 +61,7 @@ exception </em><tt class="descclassname">celery.worker.</tt><tt class="descname"
 <dl class="class">
 <dt id="celery.worker.TaskWrapper">
 <em class="property">
-class </em><tt class="descclassname">celery.worker.</tt><tt class="descname">TaskWrapper</tt><big>(</big><em>task_name</em>, <em>task_id</em>, <em>task_func</em>, <em>args</em>, <em>kwargs</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper" title="Permalink to this definition">¶</a></dt>
+class </em><tt class="descclassname">celery.worker.</tt><tt class="descname">TaskWrapper</tt><big>(</big><em>task_name</em>, <em>task_id</em>, <em>task_func</em>, <em>args</em>, <em>kwargs</em>, <em>**opts</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper" title="Permalink to this definition">¶</a></dt>
 <dd><p>Class wrapping a task to be run.</p>
 <table class="docutils field-list" frame="void" rules="none">
 <col class="field-name" />
@@ -152,7 +152,7 @@ and status in the task meta backend.</p>
 <dl class="classmethod">
 <dt id="celery.worker.TaskWrapper.from_message">
 <em class="property">
-classmethod </em><tt class="descname">from_message</tt><big>(</big><em>message</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.from_message" title="Permalink to this definition">¶</a></dt>
+classmethod </em><tt class="descname">from_message</tt><big>(</big><em>message</em>, <em>logger</em><big>)</big><a class="headerlink" href="#celery.worker.TaskWrapper.from_message" title="Permalink to this definition">¶</a></dt>
 <dd><p>Create a <a title="celery.worker.TaskWrapper" class="reference internal" href="#celery.worker.TaskWrapper"><tt class="xref docutils literal"><span class="pre">TaskWrapper</span></tt></a> from a task message sent by
 <a title="celery.messaging.TaskPublisher" class="reference external" href="celery.messaging.html#celery.messaging.TaskPublisher"><tt class="xref docutils literal"><span class="pre">celery.messaging.TaskPublisher</span></tt></a>.</p>
 <table class="docutils field-list" frame="void" rules="none">

+ 1 - 1
reference/index.html

@@ -56,7 +56,7 @@
 <tbody valign="top">
 <tr class="field"><th class="field-name">Release:</th><td class="field-body">0.2</td>
 </tr>
-<tr class="field"><th class="field-name">Date:</th><td class="field-body">June 03, 2009</td>
+<tr class="field"><th class="field-name">Date:</th><td class="field-body">June 07, 2009</td>
 </tr>
 </tbody>
 </table>

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
searchindex.js


+ 20 - 0
sources/faq.txt

@@ -27,6 +27,26 @@ celeryd is not doing anything, just hanging
 
 **Answer:** See `MySQL is throwing deadlock errors, what can I do?`_.
 
+I'm having ``IntegrityError: Duplicate Key`` errors. Why?
+----------------------------------------------------------
+
+**Answer:** See `MySQL is throwing deadlock errors, what can I do?`_.
+Thanks to howsthedotcom.
+
+My Periodic Tasks won't run
+----------------------------
+
+**Answer:** Did you register the task in the applications ``tasks.py`` module?
+(or in some other module Django loads by default, like ``models.py``?).
+
+You can find out if the celery daemon is able to run the task by executing the
+periodic task manually, by doing the following:
+
+    >>> from myapp.tasks import MyPeriodicTask
+    >>> MyPeriodicTask.delay()
+
+Watch celery daemons logfile (or output if not running as a daemon), to see
+if it's able to find the task, or if some other error is happening.
 
 Can I send some tasks to only some servers?
 --------------------------------------------

+ 85 - 67
sources/introduction.txt

@@ -90,102 +90,118 @@ by doing the following,::
 Usage
 =====
 
-Have to write a cool tutorial, but here is some simple usage info.
+Installing RabbitMQ
+-------------------
 
-*Note* You need to have a AMQP message broker running, like `RabbitMQ`_,
-and you need to have the amqp server setup in your settings file, as described
-in the `carrot distribution README`_.
 
-*Note* If you're running ``SQLite`` as the database back-end, ``celeryd`` will
-only be able to process one message at a time, this is because ``SQLite``
-doesn't allow concurrent writes.
+Configuring your Django project
+-------------------------------
 
-.. _`RabbitMQ`: http://www.rabbitmq.com
-.. _`carrot distribution README`: http://pypi.python.org/pypi/carrot/0.3.3
+Running the celery worker daemon
+--------------------------------
 
+To test this we'll be running the worker daemon in the foreground, so we can
+see what's going on without consulting the logfile::
 
-Defining tasks
---------------
+::
+    
+    $ python manage.py celeryd
 
-    >>> from celery.task import tasks
-    >>> from celery.log import setup_logger
-    >>> def do_something(some_arg, **kwargs):
-    ...     logger = setup_logger(**kwargs)
-    ...     logger.info("Did something: %s" % some_arg)
-    ...     return 42
-    >>> task.register(do_something, "do_something") 
 
-Tell the celery daemon to run a task
--------------------------------------
+However, in production you'll probably want to run the worker in the
+background as daemon instead::
 
-    >>> from celery.task import delay_task
-    >>> delay_task("do_something", some_arg="foo bar baz")
+    $ python manage.py celeryd --daemon
 
+For help on command line arguments to the worker daemon, you can execute the
+help command::
 
-Execute a task, and get its return value.
------------------------------------------
+    $ python manage.py help celeryd
 
-    >>> from celery.task import delay_task
-    >>> result = delay_task("do_something", some_arg="foo bar baz")
-    >>> result.ready()
-    False
-    >>> result.get()   # Waits until the task is done.
-    42
-    >>> result.status()
-    'DONE'
+**Note**: If you're using ``SQLite`` as the Django database back-end,
+``celeryd`` will only be able to process one task at a time, this is
+because ``SQLite`` doesn't allow concurrent writes.
 
-If the task raises an exception, the tasks status will be ``FAILURE``, and
-``result.result`` will contain the exception instance raised.
+Defining and executing tasks
+----------------------------
 
-Running the celery daemon
---------------------------
+**Please note** All of these tasks has to be stored in a real module, they can't
+be defined in the python shell or ipython/bpython. This is because the celery
+worker server needs access to the task function to be able to run it.
+So while it looks like we use the python shell to define the tasks in these
+examples, you can't do it this way. Put them in your Django applications
+``tasks`` module (the worker daemon will automatically load any ``tasks.py``
+file for all of the applications listed in ``settings.INSTALLED_APPS``.
+Execution tasks using ``delay`` and ``apply_async`` can be done from the
+python shell, but keep in mind that since arguments are pickled, you can't
+use custom classes defined in the shell session.
 
-::
+While you can use regular functions, the recommended way is creating
+a task class, this way you can cleanly upgrade the task to use the more
+advanced features of celery later.
 
-    $ cd mydjangoproject
-    $ env DJANGO_SETTINGS_MODULE=settings celeryd
-    [....]
-    [2009-04-23 17:44:05,115: INFO/Process-1] Did something: foo bar baz
-    [2009-04-23 17:44:05,118: INFO/MainProcess] Waiting for queue.
+This is a task that basically does nothing but take some arguments,
+and return value:
 
+    >>> class MyTask(Task):
+    ...     name = "myapp.mytask"
+    ...     def run(self, some_arg, **kwargs):
+    ...         logger = self.get_logger(**kwargs)
+    ...         logger.info("Did something: %s" % some_arg)
+    ...         return 42
+    >>> tasks.register(MyTask)
 
-Auto-discovery of tasks
------------------------
+Now if we want to execute this task, we can use the ``delay`` method of the
+task class (this is a handy shortcut to the ``apply_async`` method which gives
+you greater control of the task execution).
 
-``celery`` has an auto-discovery feature like the Django Admin, that
-automatically loads any ``tasks.py`` module in the applications listed
-in ``settings.INSTALLED_APPS``.
+    >>> from myapp.tasks import MyTask
+    >>> MyTask.delay(some_arg="foo")
 
-A good place to add this command could be in your ``urls.py``,
-::
+At this point, the task has been sent to the message broker. The message
+broker will hold on to the task until a celery worker server has successfully
+picked it up.
 
-    from celery.task import tasks
-    tasks.autodiscover()
+Now the task has been executed, but to know what happened with the task we
+have to check the celery logfile to see its return value and output.
+This is because we didn't keep the ``AsyncResult`` object returned by
+``delay``.
 
+The ``AsyncResult`` lets us find out the state of the task, wait for the task to
+finish and get its return value (or exception if the task failed).
 
-Then you can add new tasks in your applications ``tasks.py`` module,
-::
+So, let's execute the task again, but this time we'll keep track of the task:
 
-    from celery.task import tasks
-    from celery.log import setup_logger
-    from clickcounter.models import ClickCount
+    >>> result = MyTask.delay("do_something", some_arg="foo bar baz")
+    >>> result.ready() # returns True if the task has finished processing.
+    False
+    >>> result.result # task is not ready, so no return value yet.
+    None
+    >>> result.get()   # Waits until the task is done and return the retval.
+    42
+    >>> result.result
+    42
+    >>> result.success() # returns True if the task didn't end in failure.
+    True
 
-    def increment_click(for_url, **kwargs):
-        logger = setup_logger(**kwargs)
-        clicks_for_url, cr = ClickCount.objects.get_or_create(url=for_url)
-        clicks_for_url.clicks = clicks_for_url.clicks + 1
-        clicks_for_url.save()
-        logger.info("Incremented click count for %s (not at %d)" % (
-                        for_url, clicks_for_url.clicks)
-    tasks.register(increment_click, "increment_click")
+
+If the task raises an exception, the ``result.success()`` will be ``False``,
+and ``result.result`` will contain the exception instance raised.
+
+Auto-discovery of tasks
+-----------------------
+
+``celery`` has an auto-discovery feature like the Django Admin, that
+automatically loads any ``tasks.py`` module in the applications listed
+in ``settings.INSTALLED_APPS``. This autodiscovery is used by the celery
+worker to find registered tasks for your Django project.
 
 
 Periodic Tasks
 ---------------
 
-Periodic tasks are tasks that are run every ``n`` seconds. They don't
-support extra arguments. Here's an example of a periodic task:
-
+Periodic tasks are tasks that are run every ``n`` seconds. 
+Here's an example of a periodic task:
 
     >>> from celery.task import tasks, PeriodicTask
     >>> from datetime import timedelta
@@ -199,6 +215,8 @@ support extra arguments. Here's an example of a periodic task:
     ...
     >>> tasks.register(MyPeriodicTask)
 
+**Note:** Periodic tasks does not support arguments, as this doesn't
+really make sense.
 
 For periodic tasks to work you need to add ``celery`` to ``INSTALLED_APPS``,
 and issue a ``syncdb``.

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff