instance-repo 1.0.9.dev2__tar.gz → 1.0.9.dev4__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.
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/PKG-INFO +1 -1
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/__init__.py +1 -1
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/cli.py +37 -19
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/splits.py +58 -1
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/PKG-INFO +1 -1
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/pyproject.toml +1 -1
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/README.md +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/_routing.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/_site_defaults.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/bootstrap.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/cache.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/__init__.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/benchmarks.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/config.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/datasets.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/images.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/instances.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/reports.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/scaffold.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/versions.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/clients/workflows.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/concurrency.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/content.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/endpoints.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/errors.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/image.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/layout.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/loader.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/models.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/paths.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/release.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/repo.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/retry.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/store/__init__.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/store/acr.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/store/base.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/store/oss.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/store/registry.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/tasktoml.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/transport.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo/validate.py +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/SOURCES.txt +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/dependency_links.txt +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/entry_points.txt +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/requires.txt +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/top_level.txt +0 -0
- {instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/setup.cfg +0 -0
|
@@ -312,16 +312,16 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
312
312
|
help="get 用:覆盖 profile 派生的 environment(pre/online)")
|
|
313
313
|
|
|
314
314
|
# ── 1.0.10 控制面管理子命令 ─────────────────────────────────────────────────
|
|
315
|
-
sp = sub.add_parser("split", help="split 记录管理(list/get/set-run-type)")
|
|
316
|
-
sp.add_argument("action", choices=["list", "get", "set-run-type"])
|
|
315
|
+
sp = sub.add_parser("split", help="split 记录管理(list/get/create/set-run-type)")
|
|
316
|
+
sp.add_argument("action", choices=["list", "get", "create", "set-run-type"])
|
|
317
317
|
sp.add_argument("ref", nargs="?",
|
|
318
|
-
help="list: {L1}/{L2};get/set-run-type: {L1}/{L2}/{split}"
|
|
319
|
-
"(或用 --dataset/--split)")
|
|
318
|
+
help="list: {L1}/{L2};get/set-run-type: {L1}/{L2}/{split};"
|
|
319
|
+
"create: {L1}/{L2}/{split}(或用 --dataset/--split)")
|
|
320
320
|
sp.add_argument("--dataset", default=None, help="{L1}/{L2}")
|
|
321
321
|
sp.add_argument("--split", default=None,
|
|
322
322
|
help="目标 split 名(get/set-run-type 用)")
|
|
323
323
|
sp.add_argument("--version", default=None,
|
|
324
|
-
help="list 按 version 精确过滤;get
|
|
324
|
+
help="list 按 version 精确过滤;get 可选定位版本;create 必填")
|
|
325
325
|
sp.add_argument("--scope", choices=["unversioned", "exact", "all"], default=None,
|
|
326
326
|
help="list 跨版本策略:缺省无 version → all(SDK 取全量哲学),"
|
|
327
327
|
"有 version 省略(服务端只接受 exact)")
|
|
@@ -329,9 +329,13 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
329
329
|
help="list 按状态过滤")
|
|
330
330
|
sp.add_argument("--run-type", choices=["train", "eval", ""], default=None,
|
|
331
331
|
dest="run_type",
|
|
332
|
-
help="set-run-type 用:train/eval 或空串清除")
|
|
332
|
+
help="set-run-type/create 用:train/eval 或空串清除")
|
|
333
|
+
sp.add_argument("--storage-path", default=None, dest="storage_path",
|
|
334
|
+
help="create 用:split 壳的 storage_path(缺省自动计算)")
|
|
333
335
|
sp.add_argument("--page", type=int, default=1)
|
|
334
336
|
sp.add_argument("--page-size", type=int, default=50, dest="page_size")
|
|
337
|
+
sp.add_argument("--environment", default=None,
|
|
338
|
+
help="create 覆盖 profile 派生的 environment(pre/online)")
|
|
335
339
|
|
|
336
340
|
ds = sub.add_parser("dataset",
|
|
337
341
|
help="数据集/基准/工作流管理(list/get/update/access/"
|
|
@@ -416,7 +420,7 @@ def _resolve_split_ref(args) -> tuple[str, str]:
|
|
|
416
420
|
if args.ref:
|
|
417
421
|
segs = _split_ref(args.ref, 3)
|
|
418
422
|
return f"{segs[0]}/{segs[1]}", segs[2]
|
|
419
|
-
raise SystemExit("split get/set-run-type 需要 {L1}/{L2}/{split} 或 "
|
|
423
|
+
raise SystemExit("split get/create/set-run-type 需要 {L1}/{L2}/{split} 或 "
|
|
420
424
|
"--dataset/--split")
|
|
421
425
|
|
|
422
426
|
|
|
@@ -870,19 +874,17 @@ def main(argv=None, *, repo: Repo | None = None, out=None) -> int:
|
|
|
870
874
|
# 1.0.10:取版本完整详情(splits 明细 + manifest + 时间戳)。
|
|
871
875
|
# split_first 分支时服务端聚合 legacy 投影。
|
|
872
876
|
dv = r.versions.get(dataset, version, environment=args.environment)
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
file=out)
|
|
878
|
-
print(f"dataset_version_id={dv.
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
print(f" split\t{s.get('name','')}\tstatus={s.get('status','')}"
|
|
883
|
-
f"\toss_prefix={s.get('oss_prefix','')}"
|
|
877
|
+
# versions.get 返回 DatasetVersion dataclass(字段访问,非 dict 取值)。
|
|
878
|
+
print(f"version\t{dv.version}\tstatus={dv.status}"
|
|
879
|
+
f"\tstorage_path={dv.storage_path or ''}", file=out)
|
|
880
|
+
print(f"published_at={dv.published_at or ''}"
|
|
881
|
+
f"\tlast_ingested_at={dv.last_ingested_at or ''}", file=out)
|
|
882
|
+
print(f"dataset_version_id={dv.dataset_version_id or ''}", file=out)
|
|
883
|
+
for s in dv.splits:
|
|
884
|
+
print(f" split\t{s.get('name', '')}\tstatus={s.get('status', '')}"
|
|
885
|
+
f"\toss_prefix={s.get('oss_prefix', '')}"
|
|
884
886
|
f"\tinstance_count={s.get('instance_count') or 0}", file=out)
|
|
885
|
-
manifest = dv.
|
|
887
|
+
manifest = dv.manifest or {}
|
|
886
888
|
print(f"manifest\tinstance_count={manifest.get('instance_count') or 0}"
|
|
887
889
|
f"\tfile_count={manifest.get('file_count') or 0}"
|
|
888
890
|
f"\tsize_bytes={manifest.get('size_bytes') or 0}", file=out)
|
|
@@ -919,6 +921,22 @@ def main(argv=None, *, repo: Repo | None = None, out=None) -> int:
|
|
|
919
921
|
file=out)
|
|
920
922
|
print(f"page={res.page}/{_page_count(res)} total={res.total}", file=out)
|
|
921
923
|
return 0
|
|
924
|
+
if args.action == "create":
|
|
925
|
+
dataset, split_name = _resolve_split_ref(args)
|
|
926
|
+
if not (args.version or "").strip():
|
|
927
|
+
raise SystemExit(
|
|
928
|
+
"split create 需要 --version(apiserver CreateVersion 硬约束)")
|
|
929
|
+
sp = r.splits.create(dataset, split_name,
|
|
930
|
+
version=args.version,
|
|
931
|
+
run_type=args.run_type,
|
|
932
|
+
storage_path=args.storage_path,
|
|
933
|
+
environment=args.environment)
|
|
934
|
+
src = "projected" if sp.projected else "record"
|
|
935
|
+
print(f"created split\t{sp.name}\tversion={sp.version or ''}"
|
|
936
|
+
f"\tstatus={sp.status}\trun_type={sp.run_type or ''}"
|
|
937
|
+
f"\t[{src}]", file=out)
|
|
938
|
+
print(f"storage_path={sp.storage_path}", file=out)
|
|
939
|
+
return 0
|
|
922
940
|
# get / set-run-type:需要定位到具体 split
|
|
923
941
|
dataset, split_name = _resolve_split_ref(args)
|
|
924
942
|
if args.action == "get":
|
|
@@ -222,13 +222,68 @@ class SplitsClient:
|
|
|
222
222
|
|
|
223
223
|
# ── 写 ──
|
|
224
224
|
|
|
225
|
+
def create(self, dataset: str, split: str, *,
|
|
226
|
+
version: str, run_type: str | None = None,
|
|
227
|
+
storage_path: str | None = None,
|
|
228
|
+
environment: str | None = None) -> DatasetSplit:
|
|
229
|
+
"""创建 split 记录——组合 versions.create(splits=[split]) 的便利封装。
|
|
230
|
+
|
|
231
|
+
apiserver **没有** split create 端点(``POST /datasets/splits`` 不存在):
|
|
232
|
+
split 记录由 ingest 扫描 OSS 或 versions.create/update(splits=[...])
|
|
233
|
+
间接产生(pre 集合 find-or-upsert ensure 真实 split record)。本方法是
|
|
234
|
+
"先建空 split 壳"的官方路径升级为 SDK 直接 API:
|
|
235
|
+
|
|
236
|
+
1. ``versions.create(dataset, version, splits=[split])``(version **必填**
|
|
237
|
+
——apiserver CreateVersion 硬约束;storage_path 缺省自动计算);
|
|
238
|
+
2. 可选 ``run_type``:create 后经 versions.update(split_run_types) 打标;
|
|
239
|
+
3. 读回 ``splits.get``(同 environment)返回记录。
|
|
240
|
+
|
|
241
|
+
参数:
|
|
242
|
+
dataset : dataset 名(必填)。
|
|
243
|
+
split : split 名(必填)。
|
|
244
|
+
version : version(必填——CreateVersion 硬约束)。
|
|
245
|
+
run_type : 可选,train/eval(create 后打标)。
|
|
246
|
+
storage_path : 可选,缺省按 profile 自动计算(与 versions.create 同源)。
|
|
247
|
+
environment : 可选,缺省由 profile 派生(pre/online)。
|
|
248
|
+
|
|
249
|
+
返回 :class:`~instance_repo.models.DatasetSplit`(读回;pre 集合 ensure
|
|
250
|
+
的 record 或 version 内嵌投影)。
|
|
251
|
+
"""
|
|
252
|
+
from .versions import VersionsClient
|
|
253
|
+
if not (dataset or "").strip():
|
|
254
|
+
raise SchemaError("dataset is required for splits.create")
|
|
255
|
+
if not (split or "").strip():
|
|
256
|
+
raise SchemaError("split is required for splits.create")
|
|
257
|
+
if not (version or "").strip():
|
|
258
|
+
raise SchemaError(
|
|
259
|
+
"version is required for splits.create (apiserver CreateVersion "
|
|
260
|
+
"requires version; split records are created via versions.create)")
|
|
261
|
+
rt = (run_type or "").strip()
|
|
262
|
+
if rt and rt not in RUN_TYPE_VALUES:
|
|
263
|
+
raise SchemaError(
|
|
264
|
+
f"invalid run_type {rt!r}; must be one of "
|
|
265
|
+
f"{', '.join(RUN_TYPE_VALUES)} or None")
|
|
266
|
+
env = self._env(environment)
|
|
267
|
+
vc = VersionsClient(self._t, self._p)
|
|
268
|
+
vc.create(dataset, version, splits=[split],
|
|
269
|
+
storage_path=storage_path, environment=env or None)
|
|
270
|
+
if rt:
|
|
271
|
+
# run_type 打标与 create 互斥字段:经 split_run_types 单独打(apiserver
|
|
272
|
+
# UpdateVersion 的 run_type/split_run_types/splits 两两互斥)。
|
|
273
|
+
vc.update(dataset, version, split_run_types={split: rt})
|
|
274
|
+
return self.get(dataset, split, version=version,
|
|
275
|
+
environment=env or None)
|
|
276
|
+
|
|
225
277
|
def update(self, dataset: str, split: str | None = None, *,
|
|
226
278
|
version: str | None = None, run_type: str = "",
|
|
227
|
-
dataset_split_id: str | None = None
|
|
279
|
+
dataset_split_id: str | None = None,
|
|
280
|
+
environment: str | None = None) -> DatasetSplit:
|
|
228
281
|
"""更新 split 记录(``PATCH /datasets/splits/detail``)。
|
|
229
282
|
|
|
230
283
|
服务端 body 仅接受 ``run_type``(**必填**:"train"/"eval",空串=清除);
|
|
231
284
|
仅 online 环境(split 记录 pre 环境的写经 versions.update 走集合路由)。
|
|
285
|
+
``environment`` 缺省由 profile 派生(同 get/list);profile 派生为 pre
|
|
286
|
+
而目标 split 记录在 online 集合时,须显式传 ``environment="online"``。
|
|
232
287
|
|
|
233
288
|
寻址二选一:``dataset_split_id``(优先,split-first 精确记录 id)或
|
|
234
289
|
``dataset``+``split``(+可选 ``version``)name 三元组。
|
|
@@ -248,6 +303,8 @@ class SplitsClient:
|
|
|
248
303
|
raise SchemaError(
|
|
249
304
|
f"invalid run_type {rt!r}; must be one of "
|
|
250
305
|
f"{', '.join(RUN_TYPE_VALUES)} (empty string to clear)")
|
|
306
|
+
if (env := self._env(environment)):
|
|
307
|
+
q += f"&environment={quote(env, safe='')}"
|
|
251
308
|
data = self._t.patch(f"{self._BASE}/detail?{q}", {"run_type": rt})
|
|
252
309
|
return DatasetSplit.from_dict(data) if isinstance(data, dict) else DatasetSplit()
|
|
253
310
|
|
|
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
|
|
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
|
{instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{instance_repo-1.0.9.dev2 → instance_repo-1.0.9.dev4}/instance_repo.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|