| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">  <head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />        <title>Task Result - celery.result — Celery v0.3.20 (unstable) documentation</title>    <link rel="stylesheet" href="../static/nature.css" type="text/css" />    <link rel="stylesheet" href="../static/pygments.css" type="text/css" />    <script type="text/javascript">      var DOCUMENTATION_OPTIONS = {        URL_ROOT:    '../',        VERSION:     '0.3.20 (unstable)',        COLLAPSE_MODINDEX: false,        FILE_SUFFIX: '.html',        HAS_SOURCE:  true      };    </script>    <script type="text/javascript" src="../static/jquery.js"></script>    <script type="text/javascript" src="../static/doctools.js"></script>    <link rel="top" title="Celery v0.3.20 (unstable) documentation" href="../index.html" />    <link rel="up" title="Module API Reference" href="index.html" />    <link rel="next" title="Task Information and Utilities - celery.task" href="celery.task.html" />    <link rel="prev" title="Executing Tasks - celery.execute" href="celery.execute.html" />   </head>  <body>    <div class="related">      <h3>Navigation</h3>      <ul>        <li class="right" style="margin-right: 10px">          <a href="../genindex.html" title="General Index"             accesskey="I">index</a></li>        <li class="right" >          <a href="../modindex.html" title="Global Module Index"             accesskey="M">modules</a> |</li>        <li class="right" >          <a href="celery.task.html" title="Task Information and Utilities - celery.task"             accesskey="N">next</a> |</li>        <li class="right" >          <a href="celery.execute.html" title="Executing Tasks - celery.execute"             accesskey="P">previous</a> |</li>        <li><a href="../index.html">Celery v0.3.20 (unstable) documentation</a> »</li>          <li><a href="index.html" accesskey="U">Module API Reference</a> »</li>       </ul>    </div>      <div class="document">      <div class="documentwrapper">        <div class="bodywrapper">          <div class="body">              <div class="section" id="module-celery.result"><h1>Task Result - celery.result<a class="headerlink" href="#module-celery.result" title="Permalink to this headline">¶</a></h1><p>Asynchronous result types.</p><dl class="class"><dt id="celery.result.AsyncResult"><em class="property">class </em><tt class="descclassname">celery.result.</tt><tt class="descname">AsyncResult</tt><big>(</big><em>task_id</em><big>)</big><a class="headerlink" href="#celery.result.AsyncResult" title="Permalink to this definition">¶</a></dt><dd><p>Pending task result using the default backend.</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">Parameter:</th><td class="field-body"><em>task_id</em> – see <a title="celery.result.AsyncResult.task_id" class="reference internal" href="#celery.result.AsyncResult.task_id"><tt class="xref docutils literal"><span class="pre">task_id</span></tt></a>.</td></tr></tbody></table><dl class="attribute"><dt id="celery.result.AsyncResult.task_id"><tt class="descname">task_id</tt><a class="headerlink" href="#celery.result.AsyncResult.task_id" title="Permalink to this definition">¶</a></dt><dd>The unique identifier for this task.</dd></dl><dl class="attribute"><dt id="celery.result.AsyncResult.backend"><tt class="descname">backend</tt><a class="headerlink" href="#celery.result.AsyncResult.backend" title="Permalink to this definition">¶</a></dt><dd>Instance of <a title="celery.backends.DefaultBackend" class="reference external" href="celery.backends.html#celery.backends.DefaultBackend"><tt class="xref docutils literal"><span class="pre">celery.backends.DefaultBackend</span></tt></a>.</dd></dl></dd></dl><dl class="class"><dt id="celery.result.BaseAsyncResult"><em class="property">class </em><tt class="descclassname">celery.result.</tt><tt class="descname">BaseAsyncResult</tt><big>(</big><em>task_id</em>, <em>backend</em><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult" title="Permalink to this definition">¶</a></dt><dd><p>Base class for pending result, supports customtask meta <a title="celery.result.BaseAsyncResult.backend" class="reference internal" href="#celery.result.BaseAsyncResult.backend"><tt class="xref docutils literal"><span class="pre">backend</span></tt></a></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>task_id</em> – see <a title="celery.result.BaseAsyncResult.task_id" class="reference internal" href="#celery.result.BaseAsyncResult.task_id"><tt class="xref docutils literal"><span class="pre">task_id</span></tt></a>.</li><li><em>backend</em> – see <a title="celery.result.BaseAsyncResult.backend" class="reference internal" href="#celery.result.BaseAsyncResult.backend"><tt class="xref docutils literal"><span class="pre">backend</span></tt></a>.</li></ul></td></tr></tbody></table><dl class="attribute"><dt id="celery.result.BaseAsyncResult.task_id"><tt class="descname">task_id</tt><a class="headerlink" href="#celery.result.BaseAsyncResult.task_id" title="Permalink to this definition">¶</a></dt><dd>The unique identifier for this task.</dd></dl><dl class="attribute"><dt id="celery.result.BaseAsyncResult.backend"><tt class="descname">backend</tt><a class="headerlink" href="#celery.result.BaseAsyncResult.backend" title="Permalink to this definition">¶</a></dt><dd>The task result backend used.</dd></dl><dl class="exception"><dt id="celery.result.BaseAsyncResult.TimeoutError"><em class="property">exception </em><tt class="descname">TimeoutError</tt><a class="headerlink" href="#celery.result.BaseAsyncResult.TimeoutError" title="Permalink to this definition">¶</a></dt><dd>The operation timed out.</dd></dl><dl class="method"><dt id="celery.result.BaseAsyncResult.get"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">get</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult.get" title="Permalink to this definition">¶</a></dt><dd>Alias to <a title="celery.result.BaseAsyncResult.wait" class="reference internal" href="#celery.result.BaseAsyncResult.wait"><tt class="xref docutils literal"><span class="pre">wait()</span></tt></a>.</dd></dl><dl class="method"><dt id="celery.result.BaseAsyncResult.is_done"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">is_done</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult.is_done" title="Permalink to this definition">¶</a></dt><dd><p>Returns <tt class="xref docutils literal"><span class="pre">True</span></tt> if the task executed successfully.</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">bool</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.BaseAsyncResult.ready"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">ready</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult.ready" title="Permalink to this definition">¶</a></dt><dd><p>Returns <tt class="xref docutils literal"><span class="pre">True</span></tt> if the task executed successfully, or raisedan exception. If the task is still pending, or is waiting for retrythen <tt class="xref docutils literal"><span class="pre">False</span></tt> is returned.</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">bool</td></tr></tbody></table></dd></dl><dl class="attribute"><dt id="celery.result.BaseAsyncResult.result"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">result</tt><a class="headerlink" href="#celery.result.BaseAsyncResult.result" title="Permalink to this definition">¶</a></dt><dd><p>When the task has been executed, this contains the return value.</p><p>If the task raised an exception, this will be the exception instance.</p></dd></dl><dl class="attribute"><dt id="celery.result.BaseAsyncResult.status"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">status</tt><a class="headerlink" href="#celery.result.BaseAsyncResult.status" title="Permalink to this definition">¶</a></dt><dd><p>The current status of the task.</p><p>Can be one of the following:</p><blockquote><p><em>PENDING</em></p><blockquote>The task is waiting for execution.</blockquote><p><em>RETRY</em></p><blockquote>The task is to be retried, possibly because of failure.</blockquote><p><em>FAILURE</em></p><blockquote>The task raised an exception, or has been retried more timesthan its limit. The <a title="celery.result.BaseAsyncResult.result" class="reference internal" href="#celery.result.BaseAsyncResult.result"><tt class="xref docutils literal"><span class="pre">result</span></tt></a> attribute contains theexception raised.</blockquote><p><em>DONE</em></p><blockquote>The task executed successfully. The <a title="celery.result.BaseAsyncResult.result" class="reference internal" href="#celery.result.BaseAsyncResult.result"><tt class="xref docutils literal"><span class="pre">result</span></tt></a> attributecontains the resulting value.</blockquote></blockquote></dd></dl><dl class="method"><dt id="celery.result.BaseAsyncResult.successful"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">successful</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult.successful" title="Permalink to this definition">¶</a></dt><dd>Alias to <a title="celery.result.BaseAsyncResult.is_done" class="reference internal" href="#celery.result.BaseAsyncResult.is_done"><tt class="xref docutils literal"><span class="pre">is_done()</span></tt></a>.</dd></dl><dl class="method"><dt id="celery.result.BaseAsyncResult.wait"><tt class="descclassname">BaseAsyncResult.</tt><tt class="descname">wait</tt><big>(</big><em>timeout=None</em><big>)</big><a class="headerlink" href="#celery.result.BaseAsyncResult.wait" title="Permalink to this definition">¶</a></dt><dd><p>Wait for task, and return the result when it arrives.</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">Parameter:</th><td class="field-body"><em>timeout</em> – How long to wait in seconds, before theoperation times out.</td></tr><tr class="field"><th class="field-name" colspan="2">Raises <a title="celery.result.TimeoutError" class="reference internal" href="#celery.result.TimeoutError">TimeoutError</a>:</th></tr><tr><td> </td><td class="field-body">if <tt class="docutils literal"><span class="pre">timeout</span></tt> is not <tt class="xref docutils literal"><span class="pre">None</span></tt> andthe result does not arrive within <tt class="docutils literal"><span class="pre">timeout</span></tt> seconds.</td></tr></tbody></table><p>If the remote call raised an exception then thatexception will be re-raised.</p></dd></dl></dd></dl><dl class="class"><dt id="celery.result.TaskSetResult"><em class="property">class </em><tt class="descclassname">celery.result.</tt><tt class="descname">TaskSetResult</tt><big>(</big><em>taskset_id</em>, <em>subtasks</em><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult" title="Permalink to this definition">¶</a></dt><dd><p>Working with <tt class="xref docutils literal"><span class="pre">celery.task.TaskSet</span></tt> results.</p><p>An instance of this class is returned by<tt class="xref docutils literal"><span class="pre">celery.task.TaskSet.run()</span></tt>. It lets you inspect the status andreturn values of the taskset as a single entity.</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" colspan="2">Option taskset_id:</th></tr><tr><td> </td><td class="field-body">see <a title="celery.result.TaskSetResult.taskset_id" class="reference internal" href="#celery.result.TaskSetResult.taskset_id"><tt class="xref docutils literal"><span class="pre">taskset_id</span></tt></a>.</td></tr><tr class="field"><th class="field-name" colspan="2">Option subtasks:</th></tr><tr><td> </td><td class="field-body">see <a title="celery.result.TaskSetResult.subtasks" class="reference internal" href="#celery.result.TaskSetResult.subtasks"><tt class="xref docutils literal"><span class="pre">subtasks</span></tt></a>.</td></tr></tbody></table><dl class="attribute"><dt id="celery.result.TaskSetResult.taskset_id"><tt class="descname">taskset_id</tt><a class="headerlink" href="#celery.result.TaskSetResult.taskset_id" title="Permalink to this definition">¶</a></dt><dd>The UUID of the taskset itself.</dd></dl><dl class="attribute"><dt id="celery.result.TaskSetResult.subtasks"><tt class="descname">subtasks</tt><a class="headerlink" href="#celery.result.TaskSetResult.subtasks" title="Permalink to this definition">¶</a></dt><dd>A list of <a title="celery.result.AsyncResult" class="reference internal" href="#celery.result.AsyncResult"><tt class="xref docutils literal"><span class="pre">AsyncResult</span></tt></a> instances for all of the subtasks.</dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.completed_count"><tt class="descname">completed_count</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.completed_count" title="Permalink to this definition">¶</a></dt><dd><p>Task completion count.</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">Returns:</th><td class="field-body">the number of tasks completed.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.failed"><tt class="descname">failed</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.failed" title="Permalink to this definition">¶</a></dt><dd><p>Did the taskset fail?</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">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if any of the tasks in the taskset failed.(i.e., raised an exception)</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.iterate"><tt class="descname">iterate</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.iterate" title="Permalink to this definition">¶</a></dt><dd><p>Iterate over the return values of the tasks as they finishone by one.</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">Raises:</th><td class="field-body">The exception if any of the tasks raised an exception.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.itersubtasks"><tt class="descname">itersubtasks</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.itersubtasks" title="Permalink to this definition">¶</a></dt><dd><p>Taskset subtask iterator.</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">Returns:</th><td class="field-body">an iterator for iterating over the tasksets<a title="celery.result.AsyncResult" class="reference internal" href="#celery.result.AsyncResult"><tt class="xref docutils literal"><span class="pre">AsyncResult</span></tt></a> objects.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.join"><tt class="descname">join</tt><big>(</big><em>timeout=None</em><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.join" title="Permalink to this definition">¶</a></dt><dd><p>Gather the results for all of the tasks in the taskset,and return a list with them ordered by the order of which theywere called.</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">Parameter:</th><td class="field-body"><em>timeout</em> – The time in seconds, how longit will wait for results, before the operation times out.</td></tr><tr class="field"><th class="field-name" colspan="2">Raises <a title="celery.result.TimeoutError" class="reference internal" href="#celery.result.TimeoutError">TimeoutError</a>:</th></tr><tr><td> </td><td class="field-body">if <tt class="docutils literal"><span class="pre">timeout</span></tt> is not <tt class="xref docutils literal"><span class="pre">None</span></tt>and the operation takes longer than <tt class="docutils literal"><span class="pre">timeout</span></tt> seconds.</td></tr></tbody></table><p>If any of the tasks raises an exception, the exceptionwill be reraised by <a title="celery.result.TaskSetResult.join" class="reference internal" href="#celery.result.TaskSetResult.join"><tt class="xref docutils literal"><span class="pre">join()</span></tt></a>.</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">Returns:</th><td class="field-body">list of return values for all tasks in the taskset.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.ready"><tt class="descname">ready</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.ready" title="Permalink to this definition">¶</a></dt><dd><p>Is the task ready?</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">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if all of the tasks in the taskset has beenexecuted.</td></tr></tbody></table></dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.successful"><tt class="descname">successful</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.successful" title="Permalink to this definition">¶</a></dt><dd><p>Was the taskset successful?</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">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if all of the tasks in the taskset finishedsuccessfully (i.e. did not raise an exception).</td></tr></tbody></table></dd></dl><dl class="attribute"><dt id="celery.result.TaskSetResult.total"><tt class="descname">total</tt><a class="headerlink" href="#celery.result.TaskSetResult.total" title="Permalink to this definition">¶</a></dt><dd>The total number of tasks in the <tt class="xref docutils literal"><span class="pre">celery.task.TaskSet</span></tt>.</dd></dl><dl class="method"><dt id="celery.result.TaskSetResult.waiting"><tt class="descname">waiting</tt><big>(</big><big>)</big><a class="headerlink" href="#celery.result.TaskSetResult.waiting" title="Permalink to this definition">¶</a></dt><dd><p>Is the taskset waiting?</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">Returns:</th><td class="field-body"><tt class="xref docutils literal"><span class="pre">True</span></tt> if any of the tasks in the taskset is stillwaiting for execution.</td></tr></tbody></table></dd></dl></dd></dl><dl class="exception"><dt id="celery.result.TimeoutError"><em class="property">exception </em><tt class="descclassname">celery.result.</tt><tt class="descname">TimeoutError</tt><a class="headerlink" href="#celery.result.TimeoutError" title="Permalink to this definition">¶</a></dt><dd>The operation timed out.</dd></dl></div>          </div>        </div>      </div>      <div class="sphinxsidebar">        <div class="sphinxsidebarwrapper">            <h4>Previous topic</h4>            <p class="topless"><a href="celery.execute.html"                                  title="previous chapter">Executing Tasks - celery.execute</a></p>            <h4>Next topic</h4>            <p class="topless"><a href="celery.task.html"                                  title="next chapter">Task Information and Utilities - celery.task</a></p>            <h3>This Page</h3>            <ul class="this-page-menu">              <li><a href="../sources/reference/celery.result.txt"                     rel="nofollow">Show Source</a></li>            </ul>          <div id="searchbox" style="display: none">            <h3>Quick search</h3>              <form class="search" action="../search.html" method="get">                <input type="text" name="q" size="18" />                <input type="submit" value="Go" />                <input type="hidden" name="check_keywords" value="yes" />                <input type="hidden" name="area" value="default" />              </form>              <p class="searchtip" style="font-size: 90%">              Enter search terms or a module, class or function name.              </p>          </div>          <script type="text/javascript">$('#searchbox').show(0);</script>        </div>      </div>      <div class="clearer"></div>    </div>    <div class="related">      <h3>Navigation</h3>      <ul>        <li class="right" style="margin-right: 10px">          <a href="../genindex.html" title="General Index"             >index</a></li>        <li class="right" >          <a href="../modindex.html" title="Global Module Index"             >modules</a> |</li>        <li class="right" >          <a href="celery.task.html" title="Task Information and Utilities - celery.task"             >next</a> |</li>        <li class="right" >          <a href="celery.execute.html" title="Executing Tasks - celery.execute"             >previous</a> |</li>        <li><a href="../index.html">Celery v0.3.20 (unstable) documentation</a> »</li>          <li><a href="index.html" >Module API Reference</a> »</li>       </ul>    </div>    <div class="footer">      © Copyright 2009, Ask Solem.      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.2.    </div>  </body></html>
 |