Skip to content
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
6 changes: 6 additions & 0 deletions huey_monitor/tqdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def __init__(self,
cumulate_progress=cumulate2parents,
)

if parent_task_id:
TaskModel.objects.set_parent_task(
main_task_id=parent_task_id,
sub_task_id=task.id,
)

self.total_progress = 0

logger.info('Init TaskModel %s', self)
Expand Down
9 changes: 2 additions & 7 deletions huey_monitor_tests/test_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,10 @@ def parallel_sub_task(task, parent_task_id, item_chunk, **info_kwargs):
"""
Useless example: Just calculate the SHA256 hash from all files
"""
# Save relationship between the main and sub tasks:
TaskModel.objects.set_parent_task(
main_task_id=parent_task_id,
sub_task_id=task.id
)

total_items = len(item_chunk)

# Init progress information of this sub task:
# Init progress information of this sub task
# and save relationship between the main and sub tasks:
process_info = ProcessInfo(
task, total=total_items, parent_task_id=parent_task_id, **info_kwargs
)
Expand Down