Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/backend.py
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | def task_info(self, obj_type, obj_id, db=None, cur=None): | ||||
WHERE type = %s AND object_id = %s''', (obj_type, obj_id)) | WHERE type = %s AND object_id = %s''', (obj_type, obj_id)) | ||||
res = cur.fetchone() | res = cur.fetchone() | ||||
if res: | if res: | ||||
res['object_id'] = bytes(res['object_id']) | res['object_id'] = bytes(res['object_id']) | ||||
return res | return res | ||||
def _send_task(self, *args): | def _send_task(self, *args): | ||||
"""Send a cooking task to the celery scheduler""" | """Send a cooking task to the celery scheduler""" | ||||
task = create_oneshot_task_dict('swh-vault-cooking', *args) | task = create_oneshot_task_dict('cook-vault-bundle', *args) | ||||
added_tasks = self.scheduler.create_tasks([task]) | added_tasks = self.scheduler.create_tasks([task]) | ||||
return added_tasks[0]['id'] | return added_tasks[0]['id'] | ||||
@db_transaction() | @db_transaction() | ||||
def create_task(self, obj_type, obj_id, sticky=False, db=None, cur=None): | def create_task(self, obj_type, obj_id, sticky=False, db=None, cur=None): | ||||
"""Create and send a cooking task""" | """Create and send a cooking task""" | ||||
obj_id = hashutil.hash_to_bytes(obj_id) | obj_id = hashutil.hash_to_bytes(obj_id) | ||||
hex_id = hashutil.hash_to_hex(obj_id) | hex_id = hashutil.hash_to_hex(obj_id) | ||||
▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines |