Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopping celery task #4

Merged
merged 2 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ ENV/

# mypy
.mypy_cache/

# PyCharm files
.idea/
12 changes: 12 additions & 0 deletions celery_progress/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down