ap-client 0.8.0.dev1__tar.gz → 0.8.0.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.
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/PKG-INFO +1 -1
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/instance_commands.py +13 -5
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/repo_read_guard.py +37 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/pyproject.toml +1 -1
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/__init__.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/akpool_commands.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/api.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/cli.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/config.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/dataset_commands.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/dataset_name.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/dataset_register.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/dfs_commands.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/exporter.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/fs_commands.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/fs_storage.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/fs_transfer.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/instance_options.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/irepo_sdk.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/managed_ak.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/manifest_view.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/ossutil_hash.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/ossutil_io.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_cascade_all.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_cascade_cli.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_cascade_display.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_cascade_state.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_commands.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_diagnostics.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_display.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/profile_references.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/share_api.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/split_publish.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/submission_metadata.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/tbb.py +0 -0
- {ap_client-0.8.0.dev1 → ap_client-0.8.0.dev4}/ap_client/waiter.py +0 -0
|
@@ -956,6 +956,7 @@ def instance_pull(
|
|
|
956
956
|
dataset: str = typer.Option(..., "--dataset", help="Dataset name"),
|
|
957
957
|
split: str = typer.Option(..., "--split", help="Split name (required for remote operations)"),
|
|
958
958
|
version: Optional[str] = typer.Option(None, "--version", help=_VERSION_HELP),
|
|
959
|
+
environment: Optional[str] = typer.Option(None, "--environment", help=_ENVIRONMENT_HELP),
|
|
959
960
|
output: Optional[str] = typer.Option(
|
|
960
961
|
None, "--output", "-o", help="Output directory (default: current directory)"
|
|
961
962
|
),
|
|
@@ -971,6 +972,7 @@ def instance_pull(
|
|
|
971
972
|
from .irepo_sdk import sdk_error_exit
|
|
972
973
|
|
|
973
974
|
output_format = _fmt(output_format)
|
|
975
|
+
env = _environment(environment)
|
|
974
976
|
resolved_path = _path_value(path)
|
|
975
977
|
resolved = _version_value(version)
|
|
976
978
|
root = Path(output or ".")
|
|
@@ -982,9 +984,17 @@ def instance_pull(
|
|
|
982
984
|
)
|
|
983
985
|
|
|
984
986
|
repo = _load_repo_or_exit()
|
|
985
|
-
|
|
987
|
+
from .repo_read_guard import pull_client
|
|
988
|
+
|
|
989
|
+
try:
|
|
990
|
+
client = pull_client(repo.instances, env)
|
|
991
|
+
pull_options = oss_fallback_kwargs(repo, client, "pull", env)
|
|
992
|
+
except (TypeError, ValueError, RuntimeError) as exc:
|
|
993
|
+
raise _fail(
|
|
994
|
+
str(exc), "Upgrade Dataset support: pip install --upgrade 'ap-client[dataset]'", 2
|
|
995
|
+
) from exc
|
|
986
996
|
if resolved_path is not None:
|
|
987
|
-
pull_options
|
|
997
|
+
pull_options.update(_enhanced_options(client, "pull", {"path": resolved_path}))
|
|
988
998
|
try:
|
|
989
999
|
private_endpoint_reachable = _probe_pull_private_endpoint(repo, dataset)
|
|
990
1000
|
except Exception as exc: # noqa: BLE001
|
|
@@ -1001,9 +1011,7 @@ def instance_pull(
|
|
|
1001
1011
|
staging = Path(tempfile.mkdtemp(prefix=f"ap-pull-{instance}-"))
|
|
1002
1012
|
try:
|
|
1003
1013
|
try:
|
|
1004
|
-
written =
|
|
1005
|
-
dataset, resolved, instance, staging, split, **pull_options
|
|
1006
|
-
)
|
|
1014
|
+
written = client.pull(dataset, resolved, instance, staging, split, **pull_options)
|
|
1007
1015
|
except Exception as exc: # noqa: BLE001
|
|
1008
1016
|
sdk_error_exit(exc, what=f"instance {instance}", stage="pull")
|
|
1009
1017
|
staged = _place_under_target(Path(str(written)), staging / instance)
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import inspect
|
|
6
|
+
from copy import copy
|
|
7
|
+
from functools import partial
|
|
6
8
|
from typing import Any
|
|
7
9
|
|
|
8
10
|
STORAGE_SIDES = {
|
|
@@ -13,6 +15,41 @@ STORAGE_SIDES = {
|
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
|
|
18
|
+
class _PullMetadataProfile:
|
|
19
|
+
def __init__(self, profile: Any, environment: str) -> None:
|
|
20
|
+
self._profile = profile
|
|
21
|
+
self.dataset_environment = environment
|
|
22
|
+
|
|
23
|
+
def __getattr__(self, name: str) -> Any:
|
|
24
|
+
return getattr(self._profile, name)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def pull_client(client: Any, environment: str) -> Any:
|
|
28
|
+
"""Scope SDK 1.4.x pull metadata reads without changing its storage binding.
|
|
29
|
+
|
|
30
|
+
pull has no environment argument, although its registry supports one.
|
|
31
|
+
Copy both objects so other operations on the Repo keep their original context.
|
|
32
|
+
"""
|
|
33
|
+
if environment == "auto":
|
|
34
|
+
return client
|
|
35
|
+
registry = getattr(client, "_reg", None)
|
|
36
|
+
get = getattr(registry, "get", None)
|
|
37
|
+
if not callable(get) or "environment" not in inspect.signature(get).parameters:
|
|
38
|
+
raise ValueError(
|
|
39
|
+
"The installed instance-repo cannot scope pull metadata reads; "
|
|
40
|
+
"upgrade 'ap-client[dataset]'"
|
|
41
|
+
)
|
|
42
|
+
scoped = copy(client)
|
|
43
|
+
scoped._reg = copy(registry)
|
|
44
|
+
scoped._reg.get = partial(get, environment=environment)
|
|
45
|
+
profile = getattr(client, "_p", None)
|
|
46
|
+
if profile is not None:
|
|
47
|
+
# Directory manifests also use list_objects, which reads its environment
|
|
48
|
+
# from the profile. Delegate all storage/layout settings unchanged.
|
|
49
|
+
scoped._p = _PullMetadataProfile(profile, environment)
|
|
50
|
+
return scoped
|
|
51
|
+
|
|
52
|
+
|
|
16
53
|
def oss_fallback_kwargs(repo: Any, client: Any, method: str, environment: str) -> dict:
|
|
17
54
|
"""Allow API reads across environments; disable unsafe storage fallback.
|
|
18
55
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ap-client"
|
|
7
|
-
version = "0.8.0.
|
|
7
|
+
version = "0.8.0.dev4"
|
|
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"
|
|
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
|