Stop binding tasks to a specific instance of the celery app

The celery.shared_task decorator allows late-binding of tasks to any celery app,
which is well suited for our "task plugin" architecture.
This commit is contained in:
Nicolas Dandrimont 2019-10-17 14:42:35 +02:00
parent a64ae9641d
commit 78105940ff
11 changed files with 41 additions and 44 deletions

View file

@ -2,17 +2,17 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
from swh.scheduler.celery_backend.config import app
from celery import shared_task
from .lister import GNULister
@app.task(name=__name__ + '.GNUListerTask')
@shared_task(name=__name__ + '.GNUListerTask')
def list_gnu_full(**lister_args):
'List lister for the GNU source code archive'
GNULister(**lister_args).run()
@app.task(name=__name__ + '.ping')
@shared_task(name=__name__ + '.ping')
def _ping():
return 'OK'