Can't get "retry" to work in Celery <p>Given a file <code>myapp.py</code></p> <pre><code>from celery import Celery celery = Celery("myapp") celery.config_from_object("celeryconfig") @celery.task(default_retry_delay=5 * 60, max_retries=12) def add(a, b): with open("try.txt", "a") as f: f.write("A trial = {}!\n".format(a + b)) raise add.retry([a, b]) </code></pre> <p>Configured with a <code>celeryconfig.py</code></p> <pre><code>CELERY_IMPORTS = ["myapp"] BROKER_URL = "amqp://" CELERY_RESULT_BACKEND = "amqp" </code></pre> <p>I call in the directory that have both files:</p> <pre><code>$ celeryd -E </code></pre> <p>And then</p> <pre><code>$ python -c "import myapp; myapp.add.delay(2, 5)" </code></pre> <p>or</p> <pre><code>$ celery call myapp.add --args="[2, 5]" </code></pre> <p>So the <code>try.txt</code> is created with</p> <pre><code>A trial = 7! </code></pre> <p>only once. That means, the retry was ignored.</p> <p>I tried many other things:</p> <ul> <li>Using MongoDB as broker and backend and inspecting the database (strangely enough, I can't see anything in my broker "messages" collection even in a "countdown"-scheduled job)</li> <li>The PING example in <a href="http://comments.gmane.org/gmane.comp.python.amqp.celery.user/3745" rel="nofollow">here</a>, both with RabbitMQ and MongoDB</li> <li>Printing on the screen with both <code>print</code> (like the PING example) and <code>logging</code></li> <li>Make the retry call in an except block after an enforced <code>Exception</code> is raised, raising or returning the retry(), changing the "throw" parameter to <code>True</code>/<code>False</code>/not specified.</li> <li>Seeing what's happening with <code>celery flower</code> (in which the "broker" link shows nothing)</li> </ul> <p>But none happened to work =/</p> <p>My <code>celery report</code> output:</p> <pre><code>software -&gt; celery:3.0.19 (Chiastic Slide) kombu:2.5.10 py:2.7.3 billiard:2.7.3.28 py-amqp:N/A platform -&gt; system:Linux arch:64bit, ELF imp:CPython loader -&gt; celery.loaders.default.Loader settings -&gt; transport:amqp results:amqp </code></pre> <p>Is there anything wrong above? What I need to do to make the retry() method work?</p>