Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow TaskService Update Progress

From Leeroopedia
Revision as of 11:22, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Infiniflow_Ragflow_TaskService_Update_Progress.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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