Skip to content

Commit

Permalink
Add clarifying information to completed_count documentation (#7873)
Browse files Browse the repository at this point in the history
* Add clarifying information to completed_count docstring

* Update canvas documentation
  • Loading branch information
hankehly committed Nov 2, 2022
1 parent be1d3c0 commit 720d192
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion celery/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,11 @@ def ready(self):
def completed_count(self):
"""Task completion count.
Note that `complete` means `successful` in this context. In other words, the
return value of this method is the number of ``successful`` tasks.
Returns:
int: the number of tasks completed.
int: the number of complete (i.e. successful) tasks.
"""
return sum(int(result.successful()) for result in self.results)

Expand Down
4 changes: 3 additions & 1 deletion docs/userguide/canvas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,9 @@ It supports the following operations:

* :meth:`~celery.result.GroupResult.completed_count`

Return the number of completed subtasks.
Return the number of completed subtasks. Note that `complete` means `successful` in
this context. In other words, the return value of this method is the number of
``successful`` tasks.

* :meth:`~celery.result.GroupResult.revoke`

Expand Down

0 comments on commit 720d192

Please sign in to comment.