| @@ 30-49 (lines=20) @@ | ||
| 27 | # Ovverride default on failure method |
|
| 28 | # This is not a failed validation for a wrong value, this is an |
|
| 29 | # error in task that mean an error in coding |
|
| 30 | def on_failure(self, exc, task_id, args, kwargs, einfo): |
|
| 31 | logger.error('{0!r} failed: {1!r}'.format(task_id, exc)) |
|
| 32 | ||
| 33 | # get submission object |
|
| 34 | submission_obj = Submission.objects.get(pk=kwargs['submission_id']) |
|
| 35 | ||
| 36 | # mark submission with ERROR |
|
| 37 | submission_obj.status = ERROR |
|
| 38 | submission_obj.message = ( |
|
| 39 | "Error in sample batch delete: %s" % (str(exc))) |
|
| 40 | submission_obj.save() |
|
| 41 | ||
| 42 | send_message(submission_obj) |
|
| 43 | ||
| 44 | # send a mail to the user with the stacktrace (einfo) |
|
| 45 | submission_obj.owner.email_user( |
|
| 46 | "Error in sample batch delete for submission: %s" % ( |
|
| 47 | submission_obj.id), |
|
| 48 | ("Something goes wrong in batch delete for samples. Please report " |
|
| 49 | "this to InjectTool team\n\n %s" % str(einfo)), |
|
| 50 | ) |
|
| 51 | ||
| 52 | # TODO: submit mail to admin |
|
| @@ 30-49 (lines=20) @@ | ||
| 27 | # Ovverride default on failure method |
|
| 28 | # This is not a failed validation for a wrong value, this is an |
|
| 29 | # error in task that mean an error in coding |
|
| 30 | def on_failure(self, exc, task_id, args, kwargs, einfo): |
|
| 31 | logger.error('{0!r} failed: {1!r}'.format(task_id, exc)) |
|
| 32 | ||
| 33 | # get submission object |
|
| 34 | submission_obj = Submission.objects.get(pk=kwargs['submission_id']) |
|
| 35 | ||
| 36 | # mark submission with ERROR |
|
| 37 | submission_obj.status = ERROR |
|
| 38 | submission_obj.message = ( |
|
| 39 | "Error in animal batch delete: %s" % (str(exc))) |
|
| 40 | submission_obj.save() |
|
| 41 | ||
| 42 | send_message(submission_obj) |
|
| 43 | ||
| 44 | # send a mail to the user with the stacktrace (einfo) |
|
| 45 | submission_obj.owner.email_user( |
|
| 46 | "Error in animal batch delete for submission: %s" % ( |
|
| 47 | submission_obj.id), |
|
| 48 | ("Something goes wrong in batch delete for animals. Please report " |
|
| 49 | "this to InjectTool team\n\n %s" % str(einfo)), |
|
| 50 | ) |
|
| 51 | ||
| 52 | # TODO: submit mail to admin |
|