Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9696370
D979.id3112.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
D979.id3112.diff
View Options
diff --git a/swh/vault/backend.py b/swh/vault/backend.py
--- a/swh/vault/backend.py
+++ b/swh/vault/backend.py
@@ -15,7 +15,6 @@
from swh.scheduler.utils import create_oneshot_task_dict
from swh.vault.cache import VaultCache
from swh.vault.cookers import get_cooker
-from swh.vault.cooking_tasks import SWHCookingTask # noqa
cooking_task_name = 'swh.vault.cooking_tasks.SWHCookingTask'
diff --git a/swh/vault/cooking_tasks.py b/swh/vault/cooking_tasks.py
--- a/swh/vault/cooking_tasks.py
+++ b/swh/vault/cooking_tasks.py
@@ -3,26 +3,19 @@
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
-from swh.scheduler.task import Task
+from celery import current_app as app
+
from swh.vault.cookers import get_cooker
-class SWHCookingTask(Task):
+@app.task(name=__name__ + '.SWHCookingTask')
+def cook_bundle(obj_type, obj_id):
"""Main task to cook a bundle."""
-
- task_queue = 'swh_vault_cooking'
-
- def run_task(self, obj_type, obj_id):
- cooker = get_cooker(obj_type)(obj_type, obj_id)
- cooker.cook()
+ get_cooker(obj_type)(obj_type, obj_id).cook()
# TODO: remove once the scheduler handles priority tasks
-class SWHBatchCookingTask(Task):
+@app.task(name=__name__ + '.SWHBatchCookingTask')
+def batch_cook_bundle(obj_type, obj_id):
"""Temporary task for the batch queue."""
-
- task_queue = 'swh_vault_batch_cooking'
-
- def run_task(self, obj_type, obj_id):
- cooker = get_cooker(obj_type)(obj_type, obj_id)
- cooker.cook()
+ get_cooker(obj_type)(obj_type, obj_id).cook()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Aug 17, 7:57 PM (5 d, 21 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3221349
Attached To
D979: Rewrite celery tasks as a decorated function
Event Timeline
Log In to Comment