Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/signals.py
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | def post_deposit_save(sender, instance, created, raw, using, | ||||
# that very function. | # that very function. | ||||
if (instance.status == DEPOSIT_STATUS_DEPOSITED and | if (instance.status == DEPOSIT_STATUS_DEPOSITED and | ||||
not instance.check_task_id): | not instance.check_task_id): | ||||
# schedule deposit's checks | # schedule deposit's checks | ||||
from swh.deposit.config import PRIVATE_CHECK_DEPOSIT | from swh.deposit.config import PRIVATE_CHECK_DEPOSIT | ||||
check_url = reverse(PRIVATE_CHECK_DEPOSIT, args=args) | check_url = reverse(PRIVATE_CHECK_DEPOSIT, args=args) | ||||
task = create_oneshot_task_dict( | task = create_oneshot_task_dict( | ||||
'swh-deposit-archive-checks', | 'check-deposit-archive', | ||||
olasd: Do we really need the `-archive` suffix? There's nothing specific to archive-based deposits… | |||||
ardumontUnsubmitted Not Done Inline ActionsIndeed, plus in the end we do more than just check the deposit's archive, we check(ed?) also for some metadata. ardumont: Indeed, plus in the end we do more than just check the deposit's archive, we check(ed?) also… | |||||
deposit_check_url=check_url) | deposit_check_url=check_url) | ||||
check_task_id = schedule_task(default_config.scheduler, task) | check_task_id = schedule_task(default_config.scheduler, task) | ||||
instance.check_task_id = check_task_id | instance.check_task_id = check_task_id | ||||
instance.save() | instance.save() | ||||
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 | # schedule deposit loading | ||||
from swh.deposit.config import PRIVATE_GET_RAW_CONTENT | from swh.deposit.config import PRIVATE_GET_RAW_CONTENT | ||||
from swh.deposit.config import PRIVATE_GET_DEPOSIT_METADATA | from swh.deposit.config import PRIVATE_GET_DEPOSIT_METADATA | ||||
from swh.deposit.config import PRIVATE_PUT_DEPOSIT | from swh.deposit.config import PRIVATE_PUT_DEPOSIT | ||||
archive_url = reverse(PRIVATE_GET_RAW_CONTENT, args=args) | archive_url = reverse(PRIVATE_GET_RAW_CONTENT, args=args) | ||||
meta_url = reverse(PRIVATE_GET_DEPOSIT_METADATA, args=args) | meta_url = reverse(PRIVATE_GET_DEPOSIT_METADATA, args=args) | ||||
update_url = reverse(PRIVATE_PUT_DEPOSIT, args=args) | update_url = reverse(PRIVATE_PUT_DEPOSIT, args=args) | ||||
task = create_oneshot_task_dict( | task = create_oneshot_task_dict( | ||||
'swh-deposit-archive-loading', | 'load-deposit-from-archive', | ||||
olasdUnsubmitted Not Done Inline ActionsDitto here, do we really need the -from-archive suffix? olasd: Ditto here, do we really need the `-from-archive` suffix? | |||||
ardumontUnsubmitted Not Done Inline ActionsNope, we can drop this. ardumont: Nope, we can drop this. | |||||
ardumontUnsubmitted Not Done Inline ActionsTo synthesize, call it load-deposit and the other one check-deposit. ardumont: To synthesize, call it `load-deposit` and the other one `check-deposit`. | |||||
archive_url=archive_url, | archive_url=archive_url, | ||||
deposit_meta_url=meta_url, | deposit_meta_url=meta_url, | ||||
deposit_update_url=update_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 | ||||
instance.save() | instance.save() |
Do we really need the -archive suffix? There's nothing specific to archive-based deposits here.