Skip to content

Commit

Permalink
Merge pull request #4 from snakesonabrain/master
Browse files Browse the repository at this point in the history
Stopping celery task
  • Loading branch information
czue committed Sep 10, 2019
2 parents ca4359f + 4333c0a commit 9c60b3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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 @@ -39,6 +39,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

0 comments on commit 9c60b3e

Please sign in to comment.