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
12 changes: 12 additions & 0 deletions docs/en/configuration/01-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ Remote backends also require endpoint, bucket/collection, credentials, and timeo

This setting controls queue-job concurrency. It is separate from `vlm.media.max_concurrent`, which limits audio/video VLM calls, and does not limit individual Understanding API HTTP requests.

### `queue_workers.add_resource`

| Field | Type | Default | Description |
|---|---|---:|---|
| `max_concurrent` | integer | `4` | Number of complete AddResource jobs consumed concurrently; must be greater than `0`; requires a server restart after changes |

### `queue_workers.session_commit`

| Field | Type | Default | Description |
|---|---|---:|---|
| `max_concurrent` | integer | `4` | Number of SessionCommit jobs consumed concurrently; must be greater than `0`; requires a server restart after changes |

## HTTP Server Settings

```json
Expand Down
4 changes: 2 additions & 2 deletions docs/en/guides/01-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ Vision Language Model for semantic extraction (L0/L1 generation).
| `model` | str | Model name |
| `api_base` | str | API endpoint (optional) |
| `thinking` | bool | Enable thinking mode for VolcEngine models (default: `false`) |
| `max_concurrent` | int | Maximum concurrent semantic LLM calls (default: `64`) |
| `max_concurrent` | int | Maximum concurrent semantic LLM calls (default: `32`) |
| `max_retries` | int | Maximum retry attempts for transient VLM provider errors (default: `3`; `0` disables retry) |
| `credentials` | array | Ordered VLM credential/model list, with index 0 having the highest priority. Each item can override `provider`, `model`, `api_key`, `api_base`, `api_version`, `extra_headers`, `extra_request_body`, and `stream` |
| `failback_timeout_seconds` | float | Time threshold for attempting a step back toward a higher-priority credential after failover (default: `600`) |
Expand Down Expand Up @@ -1778,7 +1778,7 @@ For detailed encryption explanations, see [Data Encryption](../concepts/10-encry
"model": "string",
"api_base": "string",
"thinking": false,
"max_concurrent": 64,
"max_concurrent": 32,
"max_retries": 3,
"extra_headers": {},
"extra_request_body": {},
Expand Down
12 changes: 12 additions & 0 deletions docs/zh/configuration/01-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ Search 和 Find 请求的默认 `limit` 为 `10`,可以在每次 API 或 SDK

该配置控制队列作业并发,不等同于 `vlm.media.max_concurrent` 的音视频 VLM 调用并发,也不限制 Understanding API 的单独 HTTP 请求数。

### `queue_workers.add_resource`

| 字段 | 类型 | 默认值 | 说明 |
|---|---|---:|---|
| `max_concurrent` | integer | `4` | 同时消费的完整 AddResource 作业数,必须大于 `0`;修改后需重启服务 |

### `queue_workers.session_commit`

| 字段 | 类型 | 默认值 | 说明 |
|---|---|---:|---|
| `max_concurrent` | integer | `4` | 同时消费的 SessionCommit 作业数,必须大于 `0`;修改后需重启服务 |

## HTTP 服务配置

```json
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/guides/01-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ provider,并设置 `storage.vectordb.sparse_weight > 0`。自托管模型的
| `model` | str | 模型名称 |
| `api_base` | str | API 端点(可选) |
| `thinking` | bool | 启用思考模式(仅对部分火山模型生效,默认:`false`) |
| `max_concurrent` | int | 语义处理阶段 LLM 最大并发调用数(默认:`64`) |
| `max_concurrent` | int | 语义处理阶段 LLM 最大并发调用数(默认:`32`) |
| `max_retries` | int | VLM provider 瞬时错误的最大重试次数(默认:`3`;`0` 表示禁用重试) |
| `credentials` | array | 有序 VLM 凭据/模型列表,索引 0 优先级最高。每项可单独覆盖 `provider`、`model`、`api_key`、`api_base`、`api_version`、`extra_headers`、`extra_request_body` 和 `stream` |
| `failback_timeout_seconds` | float | 切换到低优先级 credential 后,尝试逐级切回的时间阈值(默认:`600`) |
Expand Down Expand Up @@ -1859,7 +1859,7 @@ Task 记录文件位于所属账号的系统目录:
"model": "string",
"api_base": "string",
"thinking": false,
"max_concurrent": 64,
"max_concurrent": 32,
"max_retries": 3,
"extra_headers": {},
"extra_request_body": {},
Expand Down
6 changes: 5 additions & 1 deletion examples/ov.conf.example
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@
},
},
},
"queue_workers": {"external_parse": {"max_concurrent": 4}},
"queue_workers": {
"external_parse": {"max_concurrent": 4},
"add_resource": {"max_concurrent": 4},
"session_commit": {"max_concurrent": 4},
},
"embedding": {
"dense": {
"model": "doubao-embedding-vision-251215",
Expand Down
14 changes: 13 additions & 1 deletion openviking/service/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ def __init__(
max_concurrent_embedding=config.embedding.max_concurrent,
max_concurrent_semantic=config.vlm.max_concurrent,
max_concurrent_external_parse=config.queue_workers.external_parse.max_concurrent,
max_concurrent_add_resource=config.queue_workers.add_resource.max_concurrent,
max_concurrent_session_commit=config.queue_workers.session_commit.max_concurrent,
binding_config=binding_config,
git_config=config.git,
)
Expand All @@ -146,8 +148,10 @@ def _init_storage(
self,
config: StorageConfig,
max_concurrent_embedding: int = 10,
max_concurrent_semantic: int = 64,
max_concurrent_semantic: int = 32,
max_concurrent_external_parse: int = 4,
max_concurrent_add_resource: int = 4,
max_concurrent_session_commit: int = 4,
binding_config: Any = None,
*,
git_config: Optional[GitConfig] = None,
Expand All @@ -169,6 +173,8 @@ def _init_storage(
max_concurrent_embedding=max_concurrent_embedding,
max_concurrent_semantic=max_concurrent_semantic,
max_concurrent_external_parse=max_concurrent_external_parse,
max_concurrent_add_resource=max_concurrent_add_resource,
max_concurrent_session_commit=max_concurrent_session_commit,
)
else:
logger.warning("RAGFS client not initialized, skipping queue manager")
Expand Down Expand Up @@ -310,6 +316,12 @@ async def initialize(self) -> None:
max_concurrent_external_parse=(
self._config.queue_workers.external_parse.max_concurrent
),
max_concurrent_add_resource=(
self._config.queue_workers.add_resource.max_concurrent
),
max_concurrent_session_commit=(
self._config.queue_workers.session_commit.max_concurrent
),
binding_config=self._build_ragfs_binding_config(),
git_config=self._config.git,
)
Expand Down
33 changes: 10 additions & 23 deletions openviking/storage/collection_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,21 +870,13 @@ async def on_dequeue(self, data: Optional[Dict[str, Any]]) -> Optional[Dict[str,
finally:
if embedding_msg is not None and request_failed_message is not None:
self._record_request_failure(embedding_msg, request_failed_message)
if embedding_msg and embedding_msg.semantic_msg_id:
from openviking.storage.queuefs.embedding_tracker import EmbeddingTaskTracker

tracker = EmbeddingTaskTracker.get_instance()
try:
await tracker.decrement(embedding_msg.semantic_msg_id)
except Exception as tracker_err:
logger.warning(f"Failed to decrement embedding tracker: {tracker_err}")
if report_error_args is not None:
self.report_error(*report_error_args)
elif report_success:
self.report_success()

async def on_cancelled(self, data: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
"""Settle semantic joins when a queued embedding is cancelled."""
"""Settle request-scoped waiting when a queued embedding is cancelled."""
embedding_msg: Optional[EmbeddingMsg] = None
try:
if data:
Expand All @@ -898,25 +890,20 @@ async def on_cancelled(self, data: Optional[Dict[str, Any]]) -> Optional[Dict[st

if embedding_msg is not None:
self._record_request_success(embedding_msg)
if embedding_msg.semantic_msg_id:
from openviking.storage.queuefs.embedding_tracker import EmbeddingTaskTracker

await EmbeddingTaskTracker.get_instance().decrement(embedding_msg.semantic_msg_id)
self.report_success()
return None

@staticmethod
def _record_request_success(embedding_msg: EmbeddingMsg) -> None:
tracker = get_request_wait_tracker()
if embedding_msg.semantic_msg_id:
tracker.record_embedding_processed(embedding_msg.telemetry_id)
else:
tracker.mark_embedding_done(embedding_msg.telemetry_id, embedding_msg.id)
get_request_wait_tracker().mark_embedding_done(
embedding_msg.telemetry_id,
embedding_msg.id,
)

@staticmethod
def _record_request_failure(embedding_msg: EmbeddingMsg, message: str) -> None:
tracker = get_request_wait_tracker()
if embedding_msg.semantic_msg_id:
tracker.record_embedding_error(embedding_msg.telemetry_id, message)
else:
tracker.mark_embedding_failed(embedding_msg.telemetry_id, embedding_msg.id, message)
get_request_wait_tracker().mark_embedding_failed(
embedding_msg.telemetry_id,
embedding_msg.id,
message,
)
1 change: 0 additions & 1 deletion openviking/storage/content_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ async def _vectorize_written_file(
parent_uri=parent.uri,
context_type=context_type,
ctx=ctx,
register_request_wait=True,
)

def _validate_mode(self, mode: str) -> None:
Expand Down
2 changes: 0 additions & 2 deletions openviking/storage/queuefs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: AGPL-3.0
from .embedding_msg import EmbeddingMsg
from .embedding_queue import EmbeddingQueue
from .embedding_tracker import EmbeddingTaskTracker
from .named_queue import NamedQueue, QueueError, QueueStatus
from .queue_manager import QueueManager, get_queue_manager, init_queue_manager
from .semantic_dag import SemanticDagExecutor
Expand All @@ -20,7 +19,6 @@
"QueueError",
"EmbeddingQueue",
"EmbeddingMsg",
"EmbeddingTaskTracker",
"SemanticQueue",
"SemanticDagExecutor",
"SemanticMsg",
Expand Down
6 changes: 1 addition & 5 deletions openviking/storage/queuefs/embedding_msg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0
import json
from dataclasses import asdict, dataclass, field
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Union
from uuid import uuid4


Expand All @@ -12,20 +12,17 @@ class EmbeddingMsg:
context_data: Dict[str, Any]
id: str = field(default_factory=lambda: str(uuid4()))
telemetry_id: str = ""
semantic_msg_id: Optional[str] = None

def __init__(
self,
message: Union[str, List[Dict[str, Any]]],
context_data: Dict[str, Any],
telemetry_id: str = "",
semantic_msg_id: Optional[str] = None,
):
self.id = str(uuid4())
self.message = message
self.context_data = context_data
self.telemetry_id = telemetry_id
self.semantic_msg_id = semantic_msg_id

def to_dict(self) -> Dict[str, Any]:
"""Convert embedding message to dictionary format."""
Expand All @@ -42,7 +39,6 @@ def from_dict(cls, data: Dict[str, Any]) -> "EmbeddingMsg":
message=data["message"],
context_data=data["context_data"],
telemetry_id=data.get("telemetry_id", ""),
semantic_msg_id=data.get("semantic_msg_id"),
)
obj.id = data.get("id", obj.id)
return obj
Expand Down
Loading
Loading