Commit 011124d47138aca5645848c00b4df59492867a7e

Authored by Sergio Oliveira
1 parent 15e7387a

Fixed celery imports

[skip ci]
colab/home/apps.py
@@ -4,6 +4,3 @@ from django.apps import AppConfig @@ -4,6 +4,3 @@ from django.apps import AppConfig
4 4
5 class HomeConfig(AppConfig): 5 class HomeConfig(AppConfig):
6 name = 'colab.home' 6 name = 'colab.home'
7 -  
8 - def ready(self):  
9 - from ..celery import app # noqa  
colab/plugins/gitlab/tasks.py
1 -from colab.plugins.gitlab.celery import app 1 +
  2 +from colab.celery import app
2 3
3 4
4 @app.task(bind=True) 5 @app.task(bind=True)
docs/source/plugindev.rst
1 1
2 -.. _plugin-dev: 2 +.. _plugin-dev:
3 3
4 Plugin Developer Documentation 4 Plugin Developer Documentation
5 ==================================== 5 ====================================
@@ -13,38 +13,6 @@ Signals @@ -13,38 +13,6 @@ Signals
13 In order to configure a plugin to able to listen and send signals using Colab 13 In order to configure a plugin to able to listen and send signals using Colab
14 signals structure, some steps are required: 14 signals structure, some steps are required:
15 15
16 -* Every plugin that needs to handle signals in colab need to use celery in order  
17 - to run taks asynchronously. This is due the fact that every time a handling  
18 - method for a signal is executed, it will be executed as a asynchronously  
19 - celery tasks, in order to not block other colab tasks. To use celery in the  
20 - plugin, file named celery.py needs to be created on the root directory of the  
21 - plugin. An example file can be seen below:  
22 -  
23 -.. code-block:: python  
24 -  
25 - m __future__ import absolute_import  
26 -  
27 - import os  
28 -  
29 - from celery import Celery  
30 -  
31 - # set the default Django settings module for the 'celery' program.  
32 - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'colab.settings')  
33 -  
34 - from django.conf import settings  
35 -  
36 - app = Celery('colab')  
37 -  
38 - app.config_from_object('django.conf:settings')  
39 - app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)  
40 -  
41 - app.conf.update(  
42 - CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend',  
43 - )  
44 - app.conf.update(  
45 - CELERY_RESULT_BACKEND='djcelery.backends.cache:CacheBackend',  
46 - )  
47 -  
48 * You must create signals.py in plugin root directory to implement both, 16 * You must create signals.py in plugin root directory to implement both,
49 registered signals and connect signals. 17 registered signals and connect signals.
50 * In the signals.py file it is necessary to declare a list variable containing all the 18 * In the signals.py file it is necessary to declare a list variable containing all the
@@ -66,7 +34,7 @@ signals structure, some steps are required: @@ -66,7 +34,7 @@ signals structure, some steps are required:
66 be seen below: 34 be seen below:
67 35
68 .. code-block:: python 36 .. code-block:: python
69 - # import app from celery.py 37 + from colab.celery import app
70 38
71 @app.task(bind=True) 39 @app.task(bind=True)
72 def handling_method(self, **kwargs): 40 def handling_method(self, **kwargs):