Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F7163493
D609.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
D609.diff
View Options
diff --git a/swh/indexer/mimetype.py b/swh/indexer/mimetype.py
--- a/swh/indexer/mimetype.py
+++ b/swh/indexer/mimetype.py
@@ -7,7 +7,8 @@
import magic
from swh.model import hashutil
-from swh.scheduler import utils
+from swh.scheduler import get_scheduler
+from swh.scheduler.utils import create_task_dict
from .indexer import ContentIndexer
@@ -40,6 +41,12 @@
"""
ADDITIONAL_CONFIG = {
+ 'scheduler': {
+ 'cls': 'remote',
+ 'args': {
+ 'url': 'http://localhost:5008',
+ },
+ },
'destination_task': ('str', None),
'tools': ('dict', {
'name': 'file',
@@ -55,11 +62,8 @@
def prepare(self):
super().prepare()
- destination_task = self.config.get('destination_task')
- if destination_task:
- self.destination_task = utils.get_task(destination_task)
- else:
- self.destination_task = None
+ self.destination_task = self.config.get('destination_task')
+ self.scheduler = get_scheduler(**self.config['scheduler'])
self.tool = self.tools[0]
def filter(self, ids):
@@ -142,7 +146,12 @@
"""
if self.destination_task:
- self.destination_task.delay(list(self._filter_text(results)))
+ assert self.scheduler
+ self.scheduler.create_tasks([create_task_dict(
+ self.destination_task,
+ 'oneshot',
+ list(self._filter_text(results))
+ )])
@click.command()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jan 30, 9:15 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3222077
Attached To
D609: Use swh.scheduler instead of celery in the MimetypeIndexer.
Event Timeline
Log In to Comment