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:
parent
a64ae9641d
commit
78105940ff
11 changed files with 41 additions and 44 deletions
|
@ -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 PackagistLister
|
||||
|
||||
|
||||
@app.task(name=__name__ + '.PackagistListerTask')
|
||||
@shared_task(name=__name__ + '.PackagistListerTask')
|
||||
def list_packagist(**lister_args):
|
||||
'List the packagist (php) registry'
|
||||
PackagistLister(**lister_args).run()
|
||||
|
||||
|
||||
@app.task(name=__name__ + '.ping')
|
||||
@shared_task(name=__name__ + '.ping')
|
||||
def _ping():
|
||||
return 'OK'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue