Skip to content
Snippets Groups Projects
Verified Commit 7b513a62 authored by Antoine R. Dumont's avatar Antoine R. Dumont
Browse files

deposit.signals: Scheduler load-deposit task with new endpoints

Related T2024
parent b646d12b
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
""" """
from swh.deposit import utils
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.dispatch import receiver from django.dispatch import receiver
...@@ -91,18 +93,11 @@ def post_deposit_save(sender, instance, created, raw, using, ...@@ -91,18 +93,11 @@ def post_deposit_save(sender, instance, created, raw, using,
elif (instance.status == DEPOSIT_STATUS_VERIFIED and elif (instance.status == DEPOSIT_STATUS_VERIFIED and
not instance.load_task_id): not instance.load_task_id):
# schedule deposit loading
from swh.deposit.config import PRIVATE_GET_RAW_CONTENT url = utils.origin_url_from(instance)
from swh.deposit.config import PRIVATE_GET_DEPOSIT_METADATA
from swh.deposit.config import PRIVATE_PUT_DEPOSIT task = create_oneshot_task_dict(
archive_url = reverse(PRIVATE_GET_RAW_CONTENT, args=args) 'load-deposit', url=url, deposit_id=instance.id)
meta_url = reverse(PRIVATE_GET_DEPOSIT_METADATA, args=args)
update_url = reverse(PRIVATE_PUT_DEPOSIT, args=args)
task = create_oneshot_task_dict('load-deposit',
archive_url=archive_url,
deposit_meta_url=meta_url,
deposit_update_url=update_url)
load_task_id = schedule_task(default_config.scheduler, task) load_task_id = schedule_task(default_config.scheduler, task)
instance.load_task_id = load_task_id instance.load_task_id = load_task_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment