Author: |
Odoo Community Association (OCA),FactorLibre |
License: |
AGPL-3 |
Branch: |
8.0 |
Repository: |
ovnicraft/celery-odoo |
Dependencies: |
base |
Languages: |
Python (136, 76.4%),
and
reStructuredText (42, 23.6%) |
Other repositories: |
5songHb/celery-odoo,
berpweb/celery-odoo,
cialuo/celery-odoo,
factorlibre/celery-odoo,
marcelomora/celery-odoo,
sc4you/celery-odoo,
and
sunliang1163/celery-odoo |
<a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.svg">
</a>
<a name="celery-queue"></a>
<h2>Celery Queue</h2>
<p>This is the base module for the execution of Odoo tasks in a celery queue</p>
<a name="installation"></a>
<h3>Installation</h3>
<p>To use this module, is necesary to install and configure celery python library</p>
<pre>
<code lang="python">pip install celery</code>
</pre>
<p>For more info on celery configuration and execution go to <a class="reference external" href="http://www.celeryproject.org/">http://www.celeryproject.org/</a></p>
<a name="configuration"></a>
<h3>Configuration</h3>
<p>To configure this module, you need to change some params in the odoo config file:</p>
<ul>
<li><p class="first">celery_broker_url this param is used to connect celery with a message broker. For example for the default config with celery and rabbitmq:</p>
<blockquote>
<p>celery_broker_url=ampq:<a class="reference external" href="mailto://guest@localhost">//guest@localhost</a>:5672/</p>
</blockquote>
</li>
<li><p class="first">celery_default_queue this param is used to define the name of the queue used in the message broker. By default is openerp</p>
<blockquote>
<p>celery_default_queue=openerp</p>
</blockquote>
</li>
</ul>
<a name="usage"></a>
<h3>Usage</h3>
<p>This module is intented to be inherited by other modules as by itself it doesn't do nothing.</p>
<p>Example for use with other modules:</p>
<pre>
<code lang="python">from openerp import api, models
from openerp.addons.celery_queue.decorators import CeleryTask
class ResPartner(models.Model):
_inherit = 'res.partner'
@CeleryTask() # This decorator is the one that defines that this method is going to be enqueued in celery
@api.multi
def heavy_function(self):
return super(ResPartner, self).heavy_function()</code>
</pre>
<p>For task execution in celery is necessary to start a celery worker, for start the
worker is necessary to include the addon path and odoo path in PYTHONPATH. Example:</p>
<pre>
<code lang="bash">export PYTHONPATH="/opt/odoo/odoo-server:/opt/odoo/modules/celery-dooo"
celery -A celery_queue.tasks worker -c 1 -Q openerp</code>
</pre>
<a name="bug-tracker"></a>
<h3>Bug Tracker</h3>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/factorlibre/celery-odoo/issues">GitHub Issues</a>. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.</p>
<a name="credits"></a>
<h3>Credits</h3>
<a name="images"></a>
<h4>Images</h4>
<ul class="simple">
<li>Odoo Community Association: <a class="reference external" href="https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg">Icon</a>.</li>
</ul>
<a name="contributors"></a>
<h4>Contributors</h4>
<ul class="simple">
<li>Hugo Santos <<a class="reference external" href="mailto:hugo.santos@factorlibre.com">hugo.santos@factorlibre.com</a>></li>
</ul>
<a name="maintainer"></a>
<h4>Maintainer</h4>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>This module is maintained by the OCA.</p>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>To contribute to this module, please visit <a class="reference external" href="https://odoo-community.org">https://odoo-community.org</a>.</p>