Skip to content

Commit 8f8791a

Browse files
author
Jens Diemer
committed
Add temporary cumulate2parents flag to ProcessInfo
Use the code from #44 but without the big README change, because `cumulate2parents` is already deprecated when it is introduced, see: * #60 * #58
1 parent 287e832 commit 8f8791a

4 files changed

Lines changed: 20 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,10 @@ You must change your Django settings and replace the app name:
187187

188188
## History
189189

190-
* [dev](https://github.com/boxine/django-huey-monitor/compare/v0.4.1...master)
190+
* [dev](https://github.com/boxine/django-huey-monitor/compare/v0.4.3...master)
191191
* _tbc_
192+
* [v0.4.3 - 07.01.2022](https://github.com/boxine/django-huey-monitor/compare/v0.4.2...v0.4.3)
193+
* Add temporary `cumulate2parents` flag to `ProcessInfo` ([contributed by formacube](https://github.com/boxine/django-huey-monitor/pull/44))
192194
* [v0.4.2 - 25.08.2020](https://github.com/boxine/django-huey-monitor/compare/v0.4.1...v0.4.2)
193195
* suppress the default_app_config attribute in Django 3.2+ (contributed by [Jonas Svarvaa](https://github.com/xolan))
194196
* [v0.4.1 - 02.06.2020](https://github.com/boxine/django-huey-monitor/compare/v0.4.0...v0.4.1)

huey_monitor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
default_app_config = 'huey_monitor.apps.HueyMonitorConfig'
1010

1111

12-
__version__ = '0.4.2'
12+
__version__ = '0.4.3'

huey_monitor/tqdm.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def __init__(self,
2121
total=None,
2222
unit='it',
2323
unit_divisor=1000,
24-
parent_task_id=None
24+
parent_task_id=None,
25+
cumulate2parents=True, # deprecated see #57
2526
):
2627
"""
2728
Parameters
@@ -32,6 +33,10 @@ def __init__(self,
3233
unit: str, optional: String that will be used to define the unit of each iteration
3334
unit_divisor: int, optional
3435
parent_task_id: int, optional: Huey Task ID if a parent Tasks exists.
36+
cumulate2parents: bool, optional: option to cumulate progress to the parent task progress
37+
Note: parent_task_id must be provided to cumulate progress to the parent task progress
38+
this option will be removed in the future, see:
39+
https://github.com/boxine/django-huey-monitor/discussions/57
3540
"""
3641
assert isinstance(task, Task), f'No task given: {task!r} (Hint: use "context=True")'
3742
self.task = task
@@ -40,6 +45,7 @@ def __init__(self,
4045
self.unit = unit
4146
self.unit_divisor = unit_divisor
4247
self.parent_task_id = parent_task_id
48+
self.cumulate2parents = cumulate2parents
4349

4450
if len(self.desc) > 64:
4551
# We call .update() that will not validate the data, so a overlong
@@ -80,13 +86,15 @@ def update(self, n=1):
8086
if self.parent_task_id:
8187
# Store information for main task, too:
8288
ids.append(self.parent_task_id)
83-
objects.append(
84-
TaskProgressModel(
85-
task_id=self.parent_task_id,
86-
progress_count=n,
87-
create_dt=now
89+
90+
if self.cumulate2parents:
91+
objects.append(
92+
TaskProgressModel(
93+
task_id=self.parent_task_id,
94+
progress_count=n,
95+
create_dt=now
96+
)
8897
)
89-
)
9098

9199
TaskProgressModel.objects.bulk_create(objects)
92100

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-huey-monitor"
3-
version = "0.4.2"
3+
version = "0.4.3"
44
description = "Django based tool for monitoring huey task queue: https://github.com/coleifer/huey"
55
authors = ["JensDiemer <git@jensdiemer.de>"]
66
packages = [

0 commit comments

Comments
 (0)