Browse Source

Merge pull request #1977 from doccano/enhancement/retry

Add retry setting explicitly to celery tasks
pull/1982/head
Hiroki Nakayama 2 years ago
committed by GitHub
parent
commit
1b46a7eccc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions
  1. 2
      backend/data_export/celery_tasks.py
  2. 2
      backend/data_import/celery_tasks.py

2
backend/data_export/celery_tasks.py

@ -55,7 +55,7 @@ def create_individual_dataset(project: Project, dirpath: str, confirmed_only: bo
service.export(filepath)
@shared_task
@shared_task(autoretry_for=(Exception,), retry_backoff=True, retry_jitter=True)
def export_dataset(project_id, file_format: str, confirmed_only=False):
project = get_object_or_404(Project, pk=project_id)
dirpath = os.path.join(settings.MEDIA_ROOT, str(uuid.uuid4()))

2
backend/data_import/celery_tasks.py

@ -46,7 +46,7 @@ def check_uploaded_files(upload_ids: List[str], file_format: Format):
return cleaned_ids, errors
@shared_task
@shared_task(autoretry_for=(Exception,), retry_backoff=True, retry_jitter=True)
def import_dataset(user_id, project_id, file_format: str, upload_ids: List[str], task: str, **kwargs):
project = get_object_or_404(Project, pk=project_id)
user = get_object_or_404(get_user_model(), pk=user_id)

Loading…
Cancel
Save