Implementation:Infiniflow Ragflow TaskService Update Progress
Appearance
| Knowledge Sources | |
|---|---|
| Domains | RAG, Task_Queue |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Concrete tool for updating task and document processing progress provided by RAGFlow TaskService.
Description
TaskService.update_progress atomically updates task progress and appends progress messages. It enforces monotonic progression (progress only increases unless going to error -1). The companion method DocumentService.increment_chunk_num updates document-level statistics after successful chunk insertion.
Usage
Called by the set_progress helper in task_executor.py throughout the processing pipeline.
Code Reference
Source Location
- Repository: ragflow
- File: api/db/services/task_service.py
- Lines: L297-351
Signature
class TaskService(CommonService):
@classmethod
@DB.connection_context()
def update_progress(cls, id: str, info: dict) -> None:
"""Update task progress and messages.
Args:
id: str - Task ID.
info: dict - Progress info with:
progress_msg: str (appended, trimmed to 3000 lines)
progress: float (0.0-1.0 or -1 for error)
Progress only updates if current != -1 AND (new == -1 OR new > current).
"""
Import
from api.db.services.task_service import TaskService
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | Task ID |
| info | dict | Yes | Progress info (progress_msg, progress) |
Outputs
| Name | Type | Description |
|---|---|---|
| (none) | None | Side effects: Task.progress, Task.progress_msg, Task.process_duration updated |
Usage Examples
from api.db.services.task_service import TaskService
# Update progress
TaskService.update_progress("task-uuid-123", {
"progress": 0.75,
"progress_msg": "Embedding generation complete"
})
# Mark error
TaskService.update_progress("task-uuid-123", {
"progress": -1,
"progress_msg": "Failed: embedding model timeout"
})
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment