Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/api/private/deposit_check.py
Show First 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | def process_get(self, req, collection_name, deposit_id): | ||||
else: | else: | ||||
deposit.status = DEPOSIT_STATUS_VERIFIED | deposit.status = DEPOSIT_STATUS_VERIFIED | ||||
response = { | response = { | ||||
'status': deposit.status, | 'status': deposit.status, | ||||
} | } | ||||
if not deposit.load_task_id and self.config['checks']: | if not deposit.load_task_id and self.config['checks']: | ||||
url = deposit.origin_url | url = deposit.origin_url | ||||
task = create_oneshot_task_dict( | task = create_oneshot_task_dict( | ||||
'load-deposit', url=url, deposit_id=deposit.id) | 'load-deposit', url=url, deposit_id=deposit.id, | ||||
retries_left=3) | |||||
load_task_id = self.scheduler.create_tasks([task])[0]['id'] | load_task_id = self.scheduler.create_tasks([task])[0]['id'] | ||||
deposit.load_task_id = load_task_id | deposit.load_task_id = load_task_id | ||||
deposit.save() | deposit.save() | ||||
return status.HTTP_200_OK, json.dumps(response), 'application/json' | return status.HTTP_200_OK, json.dumps(response), 'application/json' |