Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343089
D2162.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D2162.diff
View Options
diff --git a/swh/scheduler/tests/tasks.py b/swh/scheduler/tests/tasks.py
--- a/swh/scheduler/tests/tasks.py
+++ b/swh/scheduler/tests/tasks.py
@@ -3,12 +3,10 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
-from celery import group
+from celery import group, shared_task
-from swh.scheduler.celery_backend.config import app
-
-@app.task(name='swh.scheduler.tests.tasks.ping', bind=True)
+@shared_task(name='swh.scheduler.tests.tasks.ping', bind=True)
def ping(self, **kw):
# check this is a SWHTask
assert hasattr(self, 'log')
@@ -20,7 +18,7 @@
return 'OK'
-@app.task(name='swh.scheduler.tests.tasks.multiping', bind=True)
+@shared_task(name='swh.scheduler.tests.tasks.multiping', bind=True)
def multiping(self, n=10):
promise = group(ping.s(i=i) for i in range(n))()
self.log.debug('%s OK (spawned %s subtasks)' % (self.name, n))
@@ -28,11 +26,11 @@
return promise.id
-@app.task(name='swh.scheduler.tests.tasks.error')
+@shared_task(name='swh.scheduler.tests.tasks.error')
def not_implemented():
raise NotImplementedError('Nope')
-@app.task(name='swh.scheduler.tests.tasks.add')
+@shared_task(name='swh.scheduler.tests.tasks.add')
def add(x, y):
return x + y
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 1:15 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221410
Attached To
D2162: Use the shared_task decorator instead of binding to a specific celery app
Event Timeline
Log In to Comment