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
32 changes: 9 additions & 23 deletions benchmark/custom/session_contention_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,9 @@ async def system_status(self) -> Any: ...

async def observer_queue(self) -> Any: ...

async def add_resource(
self, *, path: str, to: str, reason: str, wait: bool, timeout: Optional[float]
) -> Any: ...
async def add_resource(self, *, path: str, to: str, reason: str, wait: bool) -> Any: ...

async def wait_processed(self, timeout: Optional[float]) -> Any: ...
async def wait_processed(self) -> Any: ...

async def find(self, *, query: str, target_uri: str, limit: int) -> Any: ...

Expand Down Expand Up @@ -278,19 +276,16 @@ async def system_status(self) -> Any:
async def observer_queue(self) -> Any:
return await self._client._get_queue_status()

async def add_resource(
self, *, path: str, to: str, reason: str, wait: bool, timeout: Optional[float]
) -> Any:
async def add_resource(self, *, path: str, to: str, reason: str, wait: bool) -> Any:
return await self._client.add_resource(
path=path,
to=to,
wait=wait,
timeout=timeout,
options={"reason": reason, "strict": False},
)

async def wait_processed(self, timeout: Optional[float]) -> Any:
return await self._client.wait_processed(timeout=timeout)
async def wait_processed(self) -> Any:
return await self._client.wait_processed()

async def find(self, *, query: str, target_uri: str, limit: int) -> Any:
result = await self._client.find(query=query, target_uri=target_uri, limit=limit)
Expand Down Expand Up @@ -353,21 +348,14 @@ async def system_status(self) -> AdapterResult:
async def observer_queue(self) -> AdapterResult:
return await self._run(["observer", "queue"])

async def add_resource(
self, *, path: str, to: str, reason: str, wait: bool, timeout: Optional[float]
) -> AdapterResult:
async def add_resource(self, *, path: str, to: str, reason: str, wait: bool) -> AdapterResult:
args = ["add-resource", path, "--to", to, "--reason", reason]
if wait:
args.append("--wait")
if timeout is not None:
args.extend(["--timeout", str(timeout)])
return await self._run(args, operation_timeout=max(self._config.timeout, 60.0))

async def wait_processed(self, timeout: Optional[float]) -> AdapterResult:
args = ["wait"]
if timeout is not None:
args.extend(["--timeout", str(timeout)])
return await self._run(args, operation_timeout=timeout or self._config.timeout)
async def wait_processed(self) -> AdapterResult:
return await self._run(["wait"])

async def find(self, *, query: str, target_uri: str, limit: int) -> AdapterResult:
return await self._run(["find", query, "--uri", target_uri, "-n", str(limit)])
Expand Down Expand Up @@ -660,7 +648,6 @@ async def worker(worker_id: int) -> None:
to=uri,
reason="OpenViking server load benchmark",
wait=False,
timeout=None,
),
resource_uri=resource_uri,
worker_id=worker_id,
Expand All @@ -683,7 +670,7 @@ async def worker(worker_id: int) -> None:
adapter,
scenario,
"wait_processed",
lambda: adapter.wait_processed(timeout=self.config.drain_timeout),
lambda: asyncio.wait_for(adapter.wait_processed(), timeout=self.config.drain_timeout),
)
self.recorder.add_phase(
PhaseMetadata(
Expand Down Expand Up @@ -903,7 +890,6 @@ async def _mixed_worker(
to=uri,
reason="OpenViking mixed load benchmark",
wait=False,
timeout=None,
),
resource_uri=resource_uri,
worker_id=worker_id,
Expand Down
9 changes: 3 additions & 6 deletions bot/vikingbot/compile/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,6 @@ async def resolve_wiki_uri(uri: str) -> bool:
root_uri=request.to,
operations=rendered.operations,
wait=False,
timeout=300.0,
)
except OpenVikingError as exc:
if exc.code == "CONFLICT":
Expand Down Expand Up @@ -1090,14 +1089,13 @@ async def source_batches():
result = {"created": [], "updated": [], "unchanged": []}
if skill_target:
result = await self._write_skill_bundle(
client=client, target_uri=request.to, rendered=rendered, timeout=300.0
client=client, target_uri=request.to, rendered=rendered
)
elif rendered.operations:
result = await client.batch_write(
root_uri=request.to,
operations=rendered.operations,
wait=False,
timeout=300.0,
skip_conflicts=True,
)
conflicts = result.get("conflicts", [])
Expand Down Expand Up @@ -1280,7 +1278,6 @@ async def _write_skill_bundle(
client: VikingClient,
target_uri: str,
rendered: RenderedBundle,
timeout: float,
) -> dict[str, list[str]]:
"""Publish one validated package, retaining untouched existing attachments.

Expand Down Expand Up @@ -1362,11 +1359,11 @@ async def _write_skill_bundle(
)
if exists:
published = await client.update_skill(
skill_name, str(skill_dir), target_uri=target_uri, wait=True, timeout=timeout
skill_name, str(skill_dir), target_uri=target_uri, wait=True
)
else:
published = await client.add_skill(
str(skill_dir), target_uri=target_uri, wait=True, timeout=timeout
str(skill_dir), target_uri=target_uri, wait=True
)
result["updated" if exists else "created"].append(
str(published.get("root_uri") or published.get("uri") or root_uri)
Expand Down
6 changes: 0 additions & 6 deletions bot/vikingbot/openviking_mount/ov_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,13 +633,11 @@ async def add_skill(
*,
target_uri: str,
wait: bool = True,
timeout: Optional[float] = None,
) -> Dict[str, Any]:
return await self.client.add_skill(
path,
options={"target_uri": target_uri},
wait=wait,
timeout=timeout,
)

async def update_skill(
Expand All @@ -649,14 +647,12 @@ async def update_skill(
*,
target_uri: str,
wait: bool = True,
timeout: Optional[float] = None,
) -> Dict[str, Any]:
return await self.client.update_skill(
skill_name,
path,
options={"target_uri": target_uri},
wait=wait,
timeout=timeout,
)

async def batch_write(
Expand All @@ -665,15 +661,13 @@ async def batch_write(
root_uri: str,
operations: List[Dict[str, Any]],
wait: bool = True,
timeout: Optional[float] = None,
skip_conflicts: bool = False,
) -> Dict[str, Any]:
"""Publish a bundle, optionally retaining conflicting targets and reporting their URIs."""
return await self.client.batch_write(
root_uri=root_uri,
operations=operations,
wait=wait,
timeout=timeout,
options={"skip_conflicts": skip_conflicts},
)

Expand Down
4 changes: 2 additions & 2 deletions crates/ov_cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ Some command help may also show the long `--output json` form. `-o json` is the

```bash
# Add URL and wait for processing
ov add-resource https://example.com/docs --wait --timeout 60
ov add-resource https://example.com/docs --wait

# Add a local directory with filters
ov add-resource ./dir \
--wait --timeout 600 \
--wait \
--ignore-dirs "node_modules,dist" \
--include "*.md,*.py" \
--exclude "*.tmp,*.log"
Expand Down
4 changes: 2 additions & 2 deletions crates/ov_cli/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,11 @@ ov -o json config list

```bash
# 添加 URL 并等待处理完成
ov add-resource https://example.com/docs --wait --timeout 60
ov add-resource https://example.com/docs --wait

# 添加本地目录并过滤文件
ov add-resource ./dir \
--wait --timeout 600 \
--wait \
--ignore-dirs "node_modules,dist" \
--include "*.md,*.py" \
--exclude "*.tmp,*.log"
Expand Down
27 changes: 2 additions & 25 deletions crates/ov_cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,12 @@ impl HttpClient {
content: &str,
mode: &str,
wait: bool,
timeout: Option<f64>,
processing_mode: &str,
tags: Vec<String>,
tag_mode: &str,
acl: Option<Value>,
) -> Result<serde_json::Value> {
let mut body = Self::build_write_body(uri, content, mode, wait, timeout, processing_mode);
let mut body = Self::build_write_body(uri, content, mode, wait, processing_mode);
add_resource_tag_fields(&mut body, &tags, tag_mode);
if let Some(acl) = acl {
body["acl"] = acl;
Expand Down Expand Up @@ -463,15 +462,13 @@ impl HttpClient {
content: &str,
mode: &str,
wait: bool,
timeout: Option<f64>,
processing_mode: &str,
) -> Value {
let mut body = serde_json::json!({
"uri": uri,
"content": content,
"mode": mode,
"wait": wait,
"timeout": timeout,
"processing_mode": processing_mode,
});
compact_request_body(&mut body);
Expand Down Expand Up @@ -683,16 +680,12 @@ impl HttpClient {
uri: &str,
recursive: bool,
wait: bool,
timeout: Option<f64>,
) -> Result<serde_json::Value> {
let mut params = vec![
let params = vec![
("uri".to_string(), uri.to_string()),
("recursive".to_string(), recursive.to_string()),
("wait".to_string(), wait.to_string()),
];
if let Some(timeout) = timeout {
params.push(("timeout".to_string(), timeout.to_string()));
}
self.delete("/api/v1/fs", &params).await
}

Expand Down Expand Up @@ -870,7 +863,6 @@ impl HttpClient {
reason: &str,
instruction: &str,
wait: bool,
timeout: Option<f64>,
strict: bool,
ignore_dirs: Option<String>,
include: Option<String>,
Expand Down Expand Up @@ -942,7 +934,6 @@ impl HttpClient {
"reason": reason,
"instruction": instruction,
"wait": wait,
"timeout": timeout,
"strict": strict,
"ignore_dirs": ignore_dirs,
"include": include,
Expand Down Expand Up @@ -978,7 +969,6 @@ impl HttpClient {
"reason": reason,
"instruction": instruction,
"wait": wait,
"timeout": timeout,
"strict": strict,
"ignore_dirs": ignore_dirs,
"include": include,
Expand All @@ -1002,7 +992,6 @@ impl HttpClient {
"reason": reason,
"instruction": instruction,
"wait": wait,
"timeout": timeout,
"strict": strict,
"ignore_dirs": ignore_dirs,
"include": include,
Expand All @@ -1024,7 +1013,6 @@ impl HttpClient {
"reason": reason,
"instruction": instruction,
"wait": wait,
"timeout": timeout,
"strict": strict,
"ignore_dirs": ignore_dirs,
"include": include,
Expand Down Expand Up @@ -1208,7 +1196,6 @@ impl HttpClient {
name: &str,
data: &str,
wait: bool,
timeout: Option<f64>,
show_progress: bool,
verbose: bool,
source_metadata: Option<Value>,
Expand Down Expand Up @@ -1238,7 +1225,6 @@ impl HttpClient {
let mut body = serde_json::json!({
"temp_file_id": temp_file_id,
"wait": wait,
"timeout": timeout,
});
if let Some(source_metadata) = source_metadata.clone() {
body["source_metadata"] = source_metadata;
Expand All @@ -1255,7 +1241,6 @@ impl HttpClient {
let mut body = serde_json::json!({
"temp_file_id": temp_file_id,
"wait": wait,
"timeout": timeout,
});
if let Some(source_metadata) = source_metadata.clone() {
body["source_metadata"] = source_metadata;
Expand All @@ -1266,7 +1251,6 @@ impl HttpClient {
let mut body = serde_json::json!({
"data": data,
"wait": wait,
"timeout": timeout,
});
if let Some(source_metadata) = source_metadata.clone() {
body["source_metadata"] = source_metadata;
Expand All @@ -1278,7 +1262,6 @@ impl HttpClient {
let mut body = serde_json::json!({
"data": data,
"wait": wait,
"timeout": timeout,
});
if let Some(source_metadata) = source_metadata {
body["source_metadata"] = source_metadata;
Expand Down Expand Up @@ -2066,7 +2049,6 @@ mod tests {
"",
"",
false,
None,
false,
None,
None,
Expand Down Expand Up @@ -2103,7 +2085,6 @@ mod tests {
"",
"",
false,
None,
false,
None,
None,
Expand Down Expand Up @@ -2266,7 +2247,6 @@ mod tests {
"updated",
"replace",
true,
Some(3.0),
"semantic_and_vectors",
);

Expand All @@ -2277,7 +2257,6 @@ mod tests {
"content": "updated",
"mode": "replace",
"wait": true,
"timeout": 3.0,
})
);
assert!(body.get("regenerate_semantics").is_none());
Expand All @@ -2291,7 +2270,6 @@ mod tests {
"updated",
"replace",
true,
None,
"semantic_and_vectors",
);

Expand All @@ -2305,7 +2283,6 @@ mod tests {
"updated",
"replace",
true,
None,
"vectors_only",
);

Expand Down
2 changes: 0 additions & 2 deletions crates/ov_cli/src/commands/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub async fn write(
content: &str,
mode: &str,
wait: bool,
timeout: Option<f64>,
processing_mode: &str,
tags: Vec<String>,
tag_mode: &str,
Expand All @@ -59,7 +58,6 @@ pub async fn write(
content,
mode,
wait,
timeout,
processing_mode,
tags,
tag_mode,
Expand Down
Loading
Loading