diff --git a/.gitignore b/.gitignore index 7bbc71c..2bb8add 100644 --- a/.gitignore +++ b/.gitignore @@ -99,3 +99,6 @@ ENV/ # mypy .mypy_cache/ + +# PyCharm files +.idea/ diff --git a/celery_progress/backend.py b/celery_progress/backend.py index d081d17..f8e80a7 100644 --- a/celery_progress/backend.py +++ b/celery_progress/backend.py @@ -36,6 +36,18 @@ def set_progress(self, current, total): } ) + def stop_task(self, current, total, exc): + self.task.update_state( + state='FAILURE', + meta={ + 'current': current, + 'total': total, + 'percent': 100.0, + 'exc_message': str(exc), + 'exc_type': str(type(exc)) + } + ) + class Progress(object):