Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
a8400ce4
Verified
Commit
a8400ce4
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Update documenttion on ProgressRecorder
parent
c81581cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!494
Refactor ProgressRecorder for non-optional Celery usage and add doc strings
,
!491
Resolve "Make Celery non-optional"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/core/util/celery_progress.py
+6
-6
6 additions, 6 deletions
aleksis/core/util/celery_progress.py
with
6 additions
and
6 deletions
aleksis/core/util/celery_progress.py
+
6
−
6
View file @
a8400ce4
...
...
@@ -8,7 +8,7 @@ from ..celery import app
class
ProgressRecorder
(
AbstractProgressRecorder
):
"""
Track the pro
c
ess of a Celery task and give data to the frontend.
"""
Track the pro
gr
ess of a Celery task and give data to the frontend.
This recorder provides the functions `set_progress` and `add_message`
which can be used to track the status of a Celery task.
...
...
@@ -23,12 +23,12 @@ class ProgressRecorder(AbstractProgressRecorder):
from aleksis.core.util.celery_progress import ProgressRecorder
@ProgressRecorder.record
def do_something(
recorder: ProgressRecorder, foo, ba
r, baz=None):
@ProgressRecorder.record
ed_task
def do_something(
foo, bar, recorde
r, baz=None):
# ...
recorder.total = len(list_with_data)
for i, item in list_with_data:
for i, item in
enumerate(
list_with_data
)
:
# ...
recorder.set_progress(i + 1)
# ...
...
...
@@ -42,7 +42,7 @@ class ProgressRecorder(AbstractProgressRecorder):
def my_view(request):
context = {}
# ...
result = do_something(foo, bar, baz=baz)
result = do_something
.delay
(foo, bar, baz=baz)
context = {
"
title
"
: _(
"
Progress: Import data
"
),
...
...
@@ -70,7 +70,7 @@ class ProgressRecorder(AbstractProgressRecorder):
The progress percentage is automatically calculated in relation to self.total.
:param current: The number of proce
ed
ed items
(no percentage)
:param current: The
absolute
number of proce
ss
ed items
"""
self
.
current
=
current
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment