ap-client 0.6.1.dev6__tar.gz → 0.6.1.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/PKG-INFO +3 -3
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/dataset_commands.py +66 -80
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/ossutil_io.py +10 -5
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/pyproject.toml +3 -3
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/__init__.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/akpool_commands.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/api.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/cli.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/config.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/dataset_name.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/dataset_register.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/dfs_commands.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/exporter.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/fs_commands.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/instance_commands.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/instance_options.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/irepo_sdk.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/managed_ak.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/manifest_view.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/ossutil_hash.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/profile_commands.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/repo_read_guard.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/share_api.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/split_publish.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/tbb.py +0 -0
- {ap_client-0.6.1.dev6 → ap_client-0.6.1.dev8}/ap_client/waiter.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: ap-client
|
|
3
|
-
Version: 0.6.1.
|
|
3
|
+
Version: 0.6.1.dev8
|
|
4
4
|
Summary: Agent Platform API Client & CLI
|
|
5
5
|
Requires-Python: >=3.10
|
|
6
6
|
Requires-Dist: irepo-artifact==0.2.2
|
|
@@ -10,9 +10,9 @@ Requires-Dist: rich>=13.0.0
|
|
|
10
10
|
Requires-Dist: typer>=0.9.0
|
|
11
11
|
Requires-Dist: websockets>=13.0
|
|
12
12
|
Provides-Extra: all
|
|
13
|
-
Requires-Dist: instance-repo[oss]<2.0.0,>=1.4.0
|
|
13
|
+
Requires-Dist: instance-repo[oss]<2.0.0,>=1.4.0; extra == 'all'
|
|
14
14
|
Provides-Extra: dataset
|
|
15
|
-
Requires-Dist: instance-repo[oss]<2.0.0,>=1.4.0
|
|
15
|
+
Requires-Dist: instance-repo[oss]<2.0.0,>=1.4.0; extra == 'dataset'
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
A lightweight Python SDK and command line interface for Agent Platform. It provides helpers for configuring API access and managing templates, datasets, jobs, and groups.
|
|
@@ -2021,71 +2021,40 @@ def dataset_split_create(
|
|
|
2021
2021
|
exit_code=2,
|
|
2022
2022
|
)
|
|
2023
2023
|
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
)
|
|
2031
|
-
|
|
2032
|
-
existing = _split_names(detail)
|
|
2033
|
-
if split in existing:
|
|
2024
|
+
# 版本化创建走独立 Split API(POST /datasets/splits),与 split-first 服务端
|
|
2025
|
+
# 契约对齐——旧 Version PATCH(splits 全量替换 / split_run_types)已被服务端
|
|
2026
|
+
# 拒绝("split-first Version group updates are not supported")。
|
|
2027
|
+
env = _environment(environment)
|
|
2028
|
+
existing = _versioned_split(dataset, resolved_version, split, environment=environment)
|
|
2029
|
+
if existing is not None:
|
|
2034
2030
|
# 幂等:已存在同名 split(设计 §4.3)。
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
payload["created"] = False
|
|
2041
|
-
_emit_detail(payload, output_format)
|
|
2042
|
-
return
|
|
2043
|
-
_emit_detail(
|
|
2044
|
-
{"dataset": dataset, "version": resolved_version, "split": split, "created": False},
|
|
2045
|
-
output_format,
|
|
2046
|
-
)
|
|
2031
|
+
payload = dict(existing)
|
|
2032
|
+
payload.setdefault("dataset", dataset)
|
|
2033
|
+
payload.setdefault("version", resolved_version)
|
|
2034
|
+
payload["created"] = False
|
|
2035
|
+
_emit_detail(payload, output_format)
|
|
2047
2036
|
return
|
|
2048
2037
|
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
_patch_version(
|
|
2052
|
-
dataset,
|
|
2053
|
-
resolved_version,
|
|
2054
|
-
{"splits": names},
|
|
2055
|
-
stage="split create",
|
|
2056
|
-
environment=environment,
|
|
2057
|
-
metadata_model=_VERSION_SPLIT_METADATA_MODEL,
|
|
2058
|
-
)
|
|
2038
|
+
from .instance_commands import _sdk_read_kwargs
|
|
2039
|
+
from .irepo_sdk import _reason
|
|
2059
2040
|
|
|
2060
|
-
|
|
2041
|
+
repo = _dataset_repo()
|
|
2042
|
+
create_kwargs = _sdk_read_kwargs(repo.splits, "create", environment=env, metadata_model="")
|
|
2061
2043
|
if resolved_run_type:
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
)
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
)
|
|
2077
|
-
|
|
2078
|
-
_emit_detail(
|
|
2079
|
-
{
|
|
2080
|
-
"dataset": dataset,
|
|
2081
|
-
"version": resolved_version,
|
|
2082
|
-
"split": split,
|
|
2083
|
-
"run_type": resolved_run_type,
|
|
2084
|
-
"splits": names,
|
|
2085
|
-
"created": True,
|
|
2086
|
-
},
|
|
2087
|
-
output_format,
|
|
2088
|
-
)
|
|
2044
|
+
create_kwargs["run_type"] = resolved_run_type
|
|
2045
|
+
try:
|
|
2046
|
+
record = repo.splits.create(dataset, split, version=resolved_version, **create_kwargs)
|
|
2047
|
+
except Exception as exc: # noqa: BLE001 - 统一走设计 §5.1 的映射
|
|
2048
|
+
raise _fail(
|
|
2049
|
+
f"Failed to create split {split} of dataset {dataset} version {resolved_version}: {_reason(exc)}",
|
|
2050
|
+
"Check the version name and write permission, then retry",
|
|
2051
|
+
) from exc
|
|
2052
|
+
payload = _model_dict(record) if record is not None else {}
|
|
2053
|
+
payload.setdefault("dataset", dataset)
|
|
2054
|
+
payload.setdefault("version", resolved_version)
|
|
2055
|
+
payload.setdefault("split", split)
|
|
2056
|
+
payload["created"] = True
|
|
2057
|
+
_emit_detail(payload, output_format)
|
|
2089
2058
|
|
|
2090
2059
|
|
|
2091
2060
|
@dataset_split_app.command("update")
|
|
@@ -2165,31 +2134,48 @@ def dataset_split_update(
|
|
|
2165
2134
|
)
|
|
2166
2135
|
return
|
|
2167
2136
|
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2137
|
+
# 版本化更新走独立 Split API(PATCH /datasets/splits/detail),预检用精确
|
|
2138
|
+
# split 身份(splits.get with version)——旧实现查 Version 内嵌 splits 再
|
|
2139
|
+
# PATCH Version,与独立 Split 记录不匹配,导致"已存在却报 not found"。
|
|
2140
|
+
env = _environment(environment)
|
|
2141
|
+
if env == "pre":
|
|
2142
|
+
raise _fail(
|
|
2143
|
+
f"Failed to update split {split} of dataset {dataset}: split records can only be changed in the online environment",
|
|
2144
|
+
"PATCH on split records only supports online; drop --environment pre",
|
|
2145
|
+
exit_code=2,
|
|
2146
|
+
)
|
|
2147
|
+
record = _versioned_split(dataset, resolved_version, split, environment=environment)
|
|
2148
|
+
if record is None:
|
|
2149
|
+
known = (
|
|
2150
|
+
", ".join(
|
|
2151
|
+
_split_names_of(
|
|
2152
|
+
_versioned_splits(
|
|
2153
|
+
dataset, resolved_version, stage="split update precheck",
|
|
2154
|
+
environment=environment,
|
|
2155
|
+
)
|
|
2156
|
+
)
|
|
2157
|
+
)
|
|
2158
|
+
or "<none>"
|
|
2159
|
+
)
|
|
2179
2160
|
raise _fail(
|
|
2180
2161
|
f"dataset {dataset} version {_version_label(resolved_version)} split {split}: "
|
|
2181
2162
|
f"update failed: not found",
|
|
2182
|
-
|
|
2163
|
+
f"Create it first: ap dataset split create {split} --dataset {dataset} "
|
|
2164
|
+
f"--version {resolved_version} (existing: {known})",
|
|
2183
2165
|
)
|
|
2184
2166
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2167
|
+
from .instance_commands import _sdk_read_kwargs
|
|
2168
|
+
from .irepo_sdk import _reason
|
|
2169
|
+
|
|
2170
|
+
repo = _dataset_repo()
|
|
2171
|
+
update_kwargs = _sdk_read_kwargs(repo.splits, "update", environment=env, metadata_model="")
|
|
2172
|
+
try:
|
|
2173
|
+
repo.splits.update(dataset, split, version=resolved_version, run_type=resolved_run_type, **update_kwargs)
|
|
2174
|
+
except Exception as exc: # noqa: BLE001 - 统一走设计 §5.1 的映射
|
|
2175
|
+
raise _fail(
|
|
2176
|
+
f"Failed to update split {split} of dataset {dataset} version {resolved_version}: {_reason(exc)}",
|
|
2177
|
+
"Write permission on this dataset is required; check the split name and the online environment, then retry",
|
|
2178
|
+
) from exc
|
|
2193
2179
|
_emit_detail(
|
|
2194
2180
|
{
|
|
2195
2181
|
"dataset": dataset,
|
|
@@ -1120,12 +1120,17 @@ class OssFiles:
|
|
|
1120
1120
|
bucket = self.bucket(remote.key, "writer")
|
|
1121
1121
|
if self._mkdir_marker_exists(bucket, remote):
|
|
1122
1122
|
return {"path": remote.path, "created": False}
|
|
1123
|
-
|
|
1123
|
+
# 版本控制探测是尽力而为:旧构建的 dataset STS 缺 GetBucketInfo
|
|
1124
|
+
# (AccessDenied 403),或桶开启/暂停版本控制时 forbid-overwrite 会被
|
|
1125
|
+
# OSS 忽略。对 zero-byte 目录 marker 这两者都无害——重复 mkdir 至多
|
|
1126
|
+
# 多出一个空 marker 版本,"非空 marker 拒绝"仍由上面的 HEAD 保证;
|
|
1127
|
+
# 因此不再因无法确认版本状态而硬拒,写入保持 forbid-overwrite 尽力语义。
|
|
1124
1128
|
try:
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
+
info = bucket.get_bucket_info()
|
|
1130
|
+
except Exception as exc:
|
|
1131
|
+
if getattr(exc, "code", None) != "AccessDenied":
|
|
1132
|
+
raise
|
|
1133
|
+
else:
|
|
1129
1134
|
_close_result(info)
|
|
1130
1135
|
try:
|
|
1131
1136
|
result = bucket.put_object(remote.key, b"", headers={"x-oss-forbid-overwrite": "true"})
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ap-client"
|
|
7
|
-
version = "0.6.1.
|
|
7
|
+
version = "0.6.1.dev8"
|
|
8
8
|
description = "Agent Platform API Client & CLI"
|
|
9
9
|
readme = { text = "A lightweight Python SDK and command line interface for Agent Platform. It provides helpers for configuring API access and managing templates, datasets, jobs, and groups.", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -19,10 +19,10 @@ dependencies = [
|
|
|
19
19
|
|
|
20
20
|
[project.optional-dependencies]
|
|
21
21
|
dataset = [
|
|
22
|
-
"instance-repo[oss]>=1.4.0
|
|
22
|
+
"instance-repo[oss]>=1.4.0,<2.0.0",
|
|
23
23
|
]
|
|
24
24
|
all = [
|
|
25
|
-
"instance-repo[oss]>=1.4.0
|
|
25
|
+
"instance-repo[oss]>=1.4.0,<2.0.0",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.scripts]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|