Passed
Pull Request — master (#40)
by Paolo
01:48
created

crbanim.tasks.ImportCRBAnimTask.on_failure()   A

Complexity

Conditions 1

Size

Total Lines 26
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 26
rs 9.6
c 0
b 0
f 0
cc 1
nop 6
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
"""
4
Created on Wed Feb 27 16:38:37 2019
5
6
@author: Paolo Cozzi <[email protected]>
7
"""
8
9
from celery.utils.log import get_task_logger
10
11
from image.celery import app as celery_app, MyTask
12
from image_app.models import Submission
13
from submissions.tasks import ImportGenericTaskMixin
14
15
from .helpers import upload_crbanim
16
17
# Get an instance of a logger
18
logger = get_task_logger(__name__)
19
20
21
class ImportCRBAnimTask(ImportGenericTaskMixin, MyTask):
22
    name = "Import CRBAnim"
23
    description = """Import CRBAnim data from CRBAnim data file"""
24
    submission_model = Submission
25
    datasource_type = "CRBAnim"
26
27
    def import_data_from_file(self, submission_obj):
28
        """Call the custom import method"""
29
30
        return upload_crbanim(submission_obj)
31
32
33
# register explicitly tasks
34
# https://github.com/celery/celery/issues/3744#issuecomment-271366923
35
celery_app.tasks.register(ImportCRBAnimTask)
36