envloop-cli 1.33.0__py3-none-any.whl → 2.0.0__py3-none-any.whl
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.
- envloop/__init__.py +4 -1
- envloop/_optional.py +33 -20
- envloop/cli.py +33 -8
- envloop/cli_errors.py +50 -37
- envloop/cli_output.py +8 -6
- envloop/client.py +1 -1
- envloop/downloads.py +5 -3
- envloop/http.py +28 -9
- envloop/lifecycle_cli.py +6 -0
- envloop/profile_secrets.py +9 -5
- envloop/resource_cli.py +1 -6
- envloop_asset/assets.py +537 -0
- envloop_asset/checkpoint_download.py +82 -0
- {envloop_data → envloop_asset}/checkpoint_upload.py +6 -6
- envloop_asset/cli.py +88 -0
- {envloop_data → envloop_asset}/cli_output.py +18 -65
- {envloop_data → envloop_asset}/client.py +58 -33
- envloop_data/data_upload.py → envloop_asset/dataset_upload.py +108 -23
- envloop_asset/direct_artifact.py +212 -0
- envloop_asset/direct_checkpoint.py +132 -0
- envloop_asset/direct_publication.py +46 -0
- envloop_asset/direct_storage.py +242 -0
- envloop_asset/direct_worker_artifact.py +86 -0
- envloop_asset/execution_content.py +23 -0
- {envloop_data → envloop_asset}/http.py +3 -3
- {envloop_data → envloop_asset}/navigation_resources.py +5 -5
- envloop_asset/publication_cli.py +83 -0
- envloop_data/data_publications.py → envloop_asset/publications.py +7 -6
- envloop_asset/r2_upload.py +27 -0
- {envloop_data → envloop_asset}/recipe_packages.py +5 -5
- envloop_asset/resource_cli.py +348 -0
- {envloop_data → envloop_asset}/runner_packages.py +6 -4
- envloop_asset/tags.py +27 -0
- envloop_data/data.py → envloop_asset/transfer.py +211 -105
- envloop_asset/upload_strategy.py +18 -0
- {envloop_cli-1.33.0.dist-info → envloop_cli-2.0.0.dist-info}/METADATA +118 -33
- envloop_cli-2.0.0.dist-info/RECORD +78 -0
- envloop_experiment/cli.py +160 -55
- envloop_experiment/cli_output.py +46 -5
- envloop_experiment/client.py +222 -32
- envloop_experiment/http.py +23 -1
- envloop_experiment/job_spec_cli.py +23 -15
- envloop_experiment/named_profile.py +57 -18
- envloop_experiment/navigation_resources.py +1 -2
- envloop_experiment/resource_cli.py +1 -3
- envloop_experiment/resources.py +0 -3
- envloop_cli-1.33.0.dist-info/RECORD +0 -67
- envloop_data/cli.py +0 -191
- envloop_data/data_cli.py +0 -442
- envloop_data/resource_cli.py +0 -175
- {envloop_data → envloop_asset}/__init__.py +0 -0
- {envloop_data → envloop_asset}/profile_updates.py +0 -0
- {envloop_data → envloop_asset}/recipes.py +0 -0
- {envloop_cli-1.33.0.dist-info → envloop_cli-2.0.0.dist-info}/WHEEL +0 -0
- {envloop_cli-1.33.0.dist-info → envloop_cli-2.0.0.dist-info}/entry_points.txt +0 -0
envloop/__init__.py
CHANGED
|
@@ -3,10 +3,13 @@ from ._optional import install_legacy_imports
|
|
|
3
3
|
from .client import Client
|
|
4
4
|
|
|
5
5
|
install_legacy_imports()
|
|
6
|
-
__all__ = ['Client', 'DecisionClient']
|
|
6
|
+
__all__ = ['Client', 'DecisionClient', 'ByteRange']
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
def __getattr__(name: str):
|
|
10
|
+
if name == 'ByteRange':
|
|
11
|
+
from ._optional import feature_attribute
|
|
12
|
+
return feature_attribute('asset','transfer','ByteRange')
|
|
10
13
|
if name == 'DecisionClient':
|
|
11
14
|
from ._optional import feature_attribute
|
|
12
15
|
return feature_attribute('experiment', 'decision', name)
|
envloop/_optional.py
CHANGED
|
@@ -13,11 +13,11 @@ from importlib.machinery import ModuleSpec
|
|
|
13
13
|
from types import ModuleType
|
|
14
14
|
from typing import Any, override
|
|
15
15
|
|
|
16
|
-
FEATURES = {'
|
|
16
|
+
FEATURES = {'asset': 'envloop_asset', 'experiment': 'envloop_experiment', 'rsi-loop': 'envloop_rsi_loop'}
|
|
17
17
|
FEATURE_COMMANDS = {
|
|
18
|
-
'
|
|
18
|
+
'asset': {
|
|
19
19
|
'dataset': 'Discover Datasets, revisions and tasks',
|
|
20
|
-
'
|
|
20
|
+
'recipe': 'Publish and manage immutable Recipes',
|
|
21
21
|
'runner': 'Discover available Runner revisions',
|
|
22
22
|
'checkpoint': 'List, share and download saved training Checkpoints',
|
|
23
23
|
'profile': 'Manage platform runtime Profiles',
|
|
@@ -32,16 +32,16 @@ FEATURE_COMMANDS = {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
MODULES: dict[str, str] = {
|
|
35
|
-
**dict.fromkeys('
|
|
35
|
+
**dict.fromkeys('profile_updates recipes'.split(), 'asset'),
|
|
36
36
|
**dict.fromkeys('train train_progress train_metrics_cli train_runner_cli train_log_cli job_logs job_cost inference decision sandbox runtime_params job_spec_cli training'.split(), 'experiment'),
|
|
37
37
|
**dict.fromkeys('loops'.split(), 'rsi-loop'),
|
|
38
38
|
}
|
|
39
39
|
CLIENTS = {
|
|
40
|
-
**{name: ('
|
|
40
|
+
**{name: ('asset', 'client') for name in ('ProfileService', 'RunnerService', 'Profiles', 'Runners')},
|
|
41
41
|
**{name: ('experiment', 'client') for name in ('TrialService', 'RpcService', 'load_task', 'validate_command', 'dataset_selector', 'Trials', 'runner_selector', 'job_budget', 'Jobs')},
|
|
42
42
|
**{name: ('base', 'downloads') for name in ('ArtifactError', 'artifact_path')},
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
ASSET_ENDPOINTS = set('open_download resolve_dataset list_runners get_runner_revision register_runner_revision runner_path profile_path put_profile list_profiles get_profile resolve_profile set_default_profile archive_profile set_profile_visibility fork_profile revoke_profile_secret export_profile import_profile open_checkpoint_archive'.split())
|
|
45
45
|
EXPERIMENT_ENDPOINTS = set('submit_job get_job get_job_result get_job_logs list_jobs job_action job_events stop_job list_trials get_task_run get_trial_detail get_trial_training list_trial_metrics list_trial_checkpoints get_task_result get_task_snapshot stop_task list_trial_artifacts open_trial_artifact'.split())
|
|
46
46
|
|
|
47
47
|
|
|
@@ -79,10 +79,19 @@ def available(feature: str):
|
|
|
79
79
|
return importlib.util.find_spec(FEATURES[feature]) is not None
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
def
|
|
82
|
+
def require_asset_dependencies():
|
|
83
83
|
"""Only ANS operations need the public protocol/download dependency."""
|
|
84
84
|
if importlib.util.find_spec('envhub') is None:
|
|
85
|
-
raise MissingFeatureError('
|
|
85
|
+
raise MissingFeatureError('asset')
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def missing_feature(error: BaseException) -> MissingFeatureError | None:
|
|
89
|
+
"""Treat a deferred import of the public ANS dependency as the missing [asset] extra."""
|
|
90
|
+
if isinstance(error, MissingFeatureError):
|
|
91
|
+
return error
|
|
92
|
+
if isinstance(error, ModuleNotFoundError) and isinstance(error.name, str) and error.name.partition('.')[0] == 'envhub':
|
|
93
|
+
return MissingFeatureError('asset')
|
|
94
|
+
return None
|
|
86
95
|
|
|
87
96
|
|
|
88
97
|
def feature_module(feature: str, module: str):
|
|
@@ -107,8 +116,8 @@ def client_attribute(name: str):
|
|
|
107
116
|
|
|
108
117
|
|
|
109
118
|
def endpoint(name: str):
|
|
110
|
-
if name in
|
|
111
|
-
feature = '
|
|
119
|
+
if name in ASSET_ENDPOINTS:
|
|
120
|
+
feature = 'asset'
|
|
112
121
|
elif name in EXPERIMENT_ENDPOINTS:
|
|
113
122
|
feature = 'experiment'
|
|
114
123
|
else:
|
|
@@ -119,7 +128,7 @@ def endpoint(name: str):
|
|
|
119
128
|
|
|
120
129
|
def navigation(name: str):
|
|
121
130
|
if name in {'Datasets', 'Checkpoints', '_checkpoint_matches', '_checkpoint_target', '_verified_checkpoint_file'}:
|
|
122
|
-
return feature_attribute('
|
|
131
|
+
return feature_attribute('asset', 'navigation_resources', name)
|
|
123
132
|
if name in {'Inference', 'InferenceResource'}:
|
|
124
133
|
return feature_attribute('experiment', 'navigation_resources', name)
|
|
125
134
|
raise AttributeError(name)
|
|
@@ -135,14 +144,18 @@ def client_resource(client: Any, name: str):
|
|
|
135
144
|
return feature_attribute('experiment', 'navigation_resources', 'Dashboard')(client.project, client.jobs, client.training_jobs)
|
|
136
145
|
from .navigation_resources import Dashboard
|
|
137
146
|
return Dashboard(client.project)
|
|
138
|
-
if name
|
|
139
|
-
return feature_attribute('
|
|
140
|
-
if name
|
|
141
|
-
return feature_attribute('
|
|
147
|
+
if name == 'profiles':
|
|
148
|
+
return feature_attribute('asset', 'assets', 'ProfileAssets')(server)
|
|
149
|
+
if name == 'runners':
|
|
150
|
+
return feature_attribute('asset', 'client', name.capitalize())(server)
|
|
151
|
+
if name == 'assets':
|
|
152
|
+
return feature_attribute('asset', 'assets', 'Assets')(server)
|
|
153
|
+
if name == 'recipes':
|
|
154
|
+
return feature_attribute('asset', 'assets', 'ContentResource')(server, 'recipe')
|
|
142
155
|
if name == 'datasets':
|
|
143
|
-
return
|
|
156
|
+
return feature_attribute('asset', 'assets', 'DatasetAssets')(server)
|
|
144
157
|
if name == 'checkpoints':
|
|
145
|
-
return feature_attribute('
|
|
158
|
+
return feature_attribute('asset', 'assets', 'ContentResource')(server, 'checkpoint')
|
|
146
159
|
if name == 'jobs':
|
|
147
160
|
return feature_attribute('experiment', 'client', 'Jobs')(server)
|
|
148
161
|
if name == 'trials':
|
|
@@ -166,9 +179,9 @@ def execute_command(args: argparse.Namespace, client: Any, cli: Any):
|
|
|
166
179
|
if args.group == 'loop':
|
|
167
180
|
return feature_module('rsi-loop', 'loop_cli').execute(args, client)
|
|
168
181
|
if args.group == 'profile':
|
|
169
|
-
return feature_module('
|
|
170
|
-
if args.group in {'
|
|
171
|
-
return feature_module('
|
|
182
|
+
return feature_module('asset', 'cli').execute_profile(args, client, cli)
|
|
183
|
+
if args.group in {'recipe', 'dataset', 'runner', 'checkpoint'}:
|
|
184
|
+
return feature_module('asset', 'resource_cli').execute(args, client)
|
|
172
185
|
from .resource_cli import execute
|
|
173
186
|
return execute(args, client)
|
|
174
187
|
|
envloop/cli.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import argparse
|
|
4
4
|
import json
|
|
5
5
|
import os
|
|
6
|
+
import re
|
|
6
7
|
import shlex
|
|
7
8
|
import sys
|
|
8
9
|
from collections.abc import Iterable, Sequence
|
|
@@ -13,14 +14,31 @@ from .client import Client
|
|
|
13
14
|
from .http import CLI_VERSION
|
|
14
15
|
|
|
15
16
|
SECTIONS = {
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
17
|
+
'EXPERIMENT': ('job', 'trial', 'runner'),
|
|
18
|
+
'RSI-LOOPS': ('loop',),
|
|
19
|
+
'ASSETS': ('dataset', 'checkpoint', 'recipe', 'profile'),
|
|
19
20
|
'MANAGE': ('billing', 'limit', 'member', 'setting'),
|
|
20
21
|
'TOOLS': ('auth', 'help'),
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
def _receipt(value: Any) -> Any:
|
|
26
|
+
"""Only safe upload metadata belongs in a durable CLI receipt."""
|
|
27
|
+
if not isinstance(value,dict) or not {'asset','operation'} <= set(value):
|
|
28
|
+
return value
|
|
29
|
+
operation = value.get('operation')
|
|
30
|
+
if not isinstance(operation,dict):
|
|
31
|
+
return value
|
|
32
|
+
safe = dict(operation)
|
|
33
|
+
if isinstance(operation.get('upload'),dict):
|
|
34
|
+
allowed = {'upload_id','state','limits','parts','expires_at','reserved_bytes','transport','uri'}
|
|
35
|
+
safe['upload'] = {key:item for key,item in operation['upload'].items() if key in allowed}
|
|
36
|
+
if isinstance(operation.get('error'),dict):
|
|
37
|
+
code = operation['error'].get('code')
|
|
38
|
+
safe['error'] = {'code':code if isinstance(code,str) and re.fullmatch(r'[A-Z][A-Z0-9_]{0,127}',code) else 'PUBLICATION_FAILED'}
|
|
39
|
+
return {**value,'operation':safe}
|
|
40
|
+
|
|
41
|
+
|
|
24
42
|
if TYPE_CHECKING:
|
|
25
43
|
_SubParsersBase = argparse._SubParsersAction[argparse.ArgumentParser]
|
|
26
44
|
else: # argparse._SubParsersAction is not subscriptable at runtime.
|
|
@@ -226,8 +244,8 @@ def _main(argv: list[str] | None = None):
|
|
|
226
244
|
cli.error("API keys must be entered with auth config or supplied through ENVLOOP_API_KEY")
|
|
227
245
|
from ._optional import IncompleteInstallationError, available
|
|
228
246
|
requested = next((value for value in argv if not value.startswith('-')), None)
|
|
229
|
-
feature = cast(dict[str | None, str], {'job': 'experiment', 'trial': 'experiment', '
|
|
230
|
-
'runner': '
|
|
247
|
+
feature = cast(dict[str | None, str], {'job': 'experiment', 'trial': 'experiment', 'recipe': 'asset', 'dataset': 'asset',
|
|
248
|
+
'runner': 'asset', 'checkpoint': 'asset', 'profile': 'asset', 'loop': 'rsi-loop'}).get(requested)
|
|
231
249
|
if feature is not None and not available(feature):
|
|
232
250
|
from .cli_errors import format_error
|
|
233
251
|
print(format_error(IncompleteInstallationError(feature)), file=sys.stderr)
|
|
@@ -282,15 +300,17 @@ def _main(argv: list[str] | None = None):
|
|
|
282
300
|
|
|
283
301
|
print(list_output(result, args, cli.prog))
|
|
284
302
|
else:
|
|
285
|
-
print(json.dumps(result, ensure_ascii=False))
|
|
303
|
+
print(json.dumps(_receipt(result), ensure_ascii=False))
|
|
286
304
|
return 1 if isinstance(result, dict) and (result.get('status') in {'failed', 'FAILED', 'CANCELLED', 'RETRYABLE_FAILED', 'BLOCKED'} or result.get('skipped')) else 0
|
|
287
305
|
except CommandExit as completed:
|
|
288
306
|
return completed.status
|
|
289
307
|
except KeyboardInterrupt as exc:
|
|
308
|
+
if isinstance(interrupted_receipt := getattr(exc,'last',None),dict) and {'asset','operation'} <= set(interrupted_receipt):
|
|
309
|
+
print(json.dumps(_receipt(interrupted_receipt),ensure_ascii=False))
|
|
290
310
|
from .cli_errors import upload_recovery
|
|
291
311
|
|
|
292
312
|
message = ('Download interrupted. Use --resume with the same destination to continue.'
|
|
293
|
-
if args.group
|
|
313
|
+
if args.group in {'dataset','checkpoint','recipe','runner'} and args.action == 'download' else 'Cancelled.')
|
|
294
314
|
print(message, file=sys.stderr)
|
|
295
315
|
if recovery := upload_recovery(exc):
|
|
296
316
|
print(recovery, file=sys.stderr)
|
|
@@ -307,7 +327,12 @@ def _main(argv: list[str] | None = None):
|
|
|
307
327
|
if isinstance(exc, WaitTimeoutError) and isinstance(exc.last, dict):
|
|
308
328
|
# The work continues on the server; keep its ID so it can be queried or waited on again.
|
|
309
329
|
last = operation_output(exc.last) if 'operation_id' in exc.last else exc.last
|
|
310
|
-
print(json.dumps(last, ensure_ascii=False))
|
|
330
|
+
print(json.dumps(_receipt(last), ensure_ascii=False))
|
|
331
|
+
elif isinstance(last_receipt := getattr(exc,'last',None),dict):
|
|
332
|
+
if {'asset','operation'} <= set(last_receipt):
|
|
333
|
+
print(json.dumps(_receipt(last_receipt),ensure_ascii=False))
|
|
334
|
+
elif 'operation_id' in last_receipt:
|
|
335
|
+
print(json.dumps(operation_output(last_receipt),ensure_ascii=False))
|
|
311
336
|
# Do not emit arbitrary exception messages, file content or credentials.
|
|
312
337
|
print(format_error(exc), file=sys.stderr)
|
|
313
338
|
return 1
|
envloop/cli_errors.py
CHANGED
|
@@ -28,16 +28,16 @@ def _register(codes: str, message: str) -> None:
|
|
|
28
28
|
_MESSAGES[code] = message
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
_register("
|
|
32
|
-
_register("
|
|
33
|
-
_register("
|
|
34
|
-
_register("
|
|
35
|
-
_register("
|
|
36
|
-
_register("
|
|
37
|
-
_register("
|
|
38
|
-
_register("
|
|
39
|
-
_register("
|
|
40
|
-
_register("
|
|
31
|
+
_register("ASSET_ACCESS_REQUIRED", "This key lacks the permission named above on the Dataset, Runner, Profile, Checkpoint or Trial artifact. Run el auth login to issue a new key that follows your project role: every role can read, and Developer or Admin can also write and delete (create, update, delete, upload, runner create). A key from el auth login --read-only cannot write; log in again without --read-only. Or give a key Read or Edit on that page in the Console under CONFIGURE > API Keys. Existing keys never gain permissions.")
|
|
32
|
+
_register("ASSET_NATIVE_INCOMPLETE ASSET_NATIVE_UNAVAILABLE", "Native catalog registration is incomplete. Retry the same input after the platform is ready.")
|
|
33
|
+
_register("ASSET_DEPENDENCIES_ACTIVE ASSET_DEPENDENCIES_UNKNOWN ASSET_DEPENDENCIES_CHANGED ASSET_DELETE_CONFLICT", "Retirement requires a complete, current dependency check. Resolve active or unknown dependencies, then retry the same resource.")
|
|
34
|
+
_register("ASSET_PUBLICATION_INVALID", "Check the immutable ANS URI, native manifest and exact file sizes and SHA-256 values. A record Dataset source is https://github.com/OWNER/REPO or https://huggingface.co/datasets/ORG/NAME with the full commit, not a branch or tag.")
|
|
35
|
+
_register("ASSET_PIN_CONFLICT ASSET_REVISION_REQUIRED", "Publish a new immutable revision; existing and revoked references cannot be overwritten.")
|
|
36
|
+
_register("ASSET_QUOTA_EXCEEDED ASSET_QUOTA_UNCONFIGURED", "Ask a project administrator to configure publication storage quota. Revoking publications does not free retained content.")
|
|
37
|
+
_register("ASSET_UPLOAD_CONFLICT ASSET_UPLOAD_INCOMPLETE ASSET_UPLOAD_RATE_LIMITED", "Inspect the upload with RESOURCE upload get; resume matching parts or explicitly abort it.")
|
|
38
|
+
_register("ASSET_RESUME_MISMATCH", "The saved transfer no longer matches this resource. Use a new destination to restart.")
|
|
39
|
+
_register("ASSET_HASH_MISMATCH ASSET_SIZE_MISMATCH", "The downloaded bytes do not match the published file. The destination was not installed.")
|
|
40
|
+
_register("ASSET_REDIRECT_REJECTED", "The API returned a redirect. EL Assets requires an authenticated proxy; update or contact the platform administrator.")
|
|
41
41
|
_register("HTTP_ERROR", "The API request failed.")
|
|
42
42
|
_register("API_KEY_SCOPE_MISMATCH", "An API key works only in the workspace and project it was issued for. Set ENVLOOP_WORKSPACE_ID and ENVLOOP_PROJECT_ID (or el auth workspace) to the key's own scope named above, or use a key issued in the target project.")
|
|
43
43
|
_register("NOT_FOUND RESOURCE_NOT_FOUND JOB_NOT_FOUND RUNNER_NOT_FOUND DATASET_REVISION_NOT_FOUND PROFILE_NOT_FOUND WORKSPACE_NOT_FOUND CHECKPOINT_NOT_FOUND ARTIFACT_NOT_FOUND", "The requested API resource or route was not found.")
|
|
@@ -51,15 +51,16 @@ _register("PROFILE_SECRET_NAME_INVALID", "A Secret parameter name must look like
|
|
|
51
51
|
_register("PROFILE_SECRET_VALUE_INVALID", "A Secret parameter value is missing or unusable: it must be non-empty UTF-8 text of at most 64 KiB from a prompt, stdin, an environment variable or a file.")
|
|
52
52
|
_register("PROFILE_MODEL_KEY_UNSUPPORTED", "--model-api-key-stdin and --prompt-model-api-key only set the encrypted key of a managed model connection (params.model_connection). Store other keys as a Secret parameter, for example --secret MODEL_API_KEY=stdin.")
|
|
53
53
|
_register("PROFILE_SECRET_CONFLICT", "Give each Secret parameter once, by --secret only (not also in the Profile file or patch), and read at most one value from stdin.")
|
|
54
|
-
_register("
|
|
54
|
+
_register("RUNNER_SCHEMA_UNSUPPORTED", "New Runner content requires envloop.runner/v7 and bench for evaluation; fixed historical revisions stay readable.")
|
|
55
|
+
_register("RUNNER_PACKAGE_INVALID", "The Runner package directory is invalid. It needs runner.toml whose [runner] name matches the Runner and has no version, schema_version envloop.runner/v7 and an entrypoint main.py or main.sh in [runner], at most 100 regular files, no symlinks, and path parts of letters, digits, '_', '.' or '-' that do not start with '.'. v7 declarations must satisfy the EnvHub protocol, including supported types and per-type defaults.")
|
|
55
56
|
_register("RUNNER_REVISION_INVALID", "Use the full lowercase 40- or 64-character source commit, or a local branch or tag name, as --revision and a NAMESPACE/NAME Runner name.")
|
|
56
57
|
_register("RUNNER_REVISION_UNRESOLVED", "--revision names no local branch or tag in the Git checkout that holds DIRECTORY, or Git is unavailable. Fetch or create the branch, or pass the full source commit.")
|
|
57
58
|
_register("RUNNER_PACKAGE_UNCOMMITTED", "DIRECTORY differs from the --revision commit: it has uncommitted changes, untracked files or ignored files, all of which would be published. Commit or remove them, or pass a full commit you vouch for.")
|
|
58
59
|
_register("RUNNER_SOURCE_REF_INVALID", "Use a branch or tag name such as main or v1 with --source-ref-kind branch, tag or commit; HEAD, latest, default, release, '..', spaces and ~^:?*[\\ are not allowed.")
|
|
59
60
|
_register("RUNNER_REVISION_CONFLICT", "The platform catalog holds different package or index hashes for this Runner revision. Publish a new revision instead of changing an existing one.")
|
|
60
|
-
_register("RECIPE_PACKAGE_INVALID RECIPE_DECLARATION_INVALID RECIPE_INVALID", "--directory must hold recipe.toml with schema_version = \"envloop.recipe/
|
|
61
|
-
_register("RECIPE_PACKAGE_SCHEMA_RETIRED", "recipe.toml uses the retired envloop.recipe-publication/v3 format. Rewrite it as schema_version = \"envloop.recipe/
|
|
62
|
-
_register("RECIPE_SCHEMA_UNSUPPORTED RECIPE_PACKAGE_SCHEMA_UNSUPPORTED", "Set schema_version = \"envloop.recipe/
|
|
61
|
+
_register("RECIPE_PACKAGE_INVALID RECIPE_DECLARATION_INVALID RECIPE_INVALID", "--directory must hold recipe.toml with schema_version = \"envloop.recipe/v3\" and the tables [recipe] name, types; [runner] name, abi; [source] paths, optional exclude and optional repository (a https://github.com/OWNER/REPO URL if given; omit it for a local-only repository); optional [inputs], [params], [outputs] and [dependencies]. No other top-level tables or keys are allowed.")
|
|
62
|
+
_register("RECIPE_PACKAGE_SCHEMA_RETIRED", "recipe.toml uses the retired envloop.recipe-publication/v3 format. Rewrite it as schema_version = \"envloop.recipe/v3\" with [recipe], [runner] and [source] tables and add entrypoint.sh next to it; published Recipes stay readable.")
|
|
63
|
+
_register("RECIPE_SCHEMA_UNSUPPORTED RECIPE_PACKAGE_SCHEMA_UNSUPPORTED", "Set schema_version = \"envloop.recipe/v3\" at the top of recipe.toml.")
|
|
63
64
|
_register("RECIPE_ABI_UNSUPPORTED", "Set [runner] abi = \"envloop.recipe/1\"; it is the only Recipe ABI for new Recipes.")
|
|
64
65
|
_register("RECIPE_DECLARATION_NOT_FOUND", "The --revision commit has no recipe.toml in --directory. Commit the declaration, or point --directory at the directory that holds it.")
|
|
65
66
|
_register("RECIPE_ENTRYPOINT_NOT_FOUND", "The --revision commit has no entrypoint.sh next to recipe.toml, or it is not a regular file of at most 512 MiB. Commit entrypoint.sh in the same directory as recipe.toml.")
|
|
@@ -71,23 +72,24 @@ _register("RECIPE_PACKAGE_TOO_LARGE", "A Recipe package holds at most 1000 files
|
|
|
71
72
|
_register("RECIPE_DEPENDENCY_INVALID", "Each [dependencies.SLOT] needs the uri and manifest_sha256 of an already published Recipe, envloop://recipes/NAMESPACE/NAME@SHA256, with the same digest in both.")
|
|
72
73
|
_register("RECIPE_NAME_INVALID", "[recipe] name is NAMESPACE/NAME using letters, digits, '_', '.' or '-'.")
|
|
73
74
|
_register("RECIPE_NAME_MISMATCH", "[recipe] name in recipe.toml must equal the NAMESPACE/NAME of the Recipe URI. Publish with --directory so the URI is derived from recipe.toml.")
|
|
74
|
-
_register("
|
|
75
|
+
_register("RECIPE_PUBLICATION_RETIRED", "Build a new Recipe from recipe.toml (envloop.recipe/v3) and entrypoint.sh; legacy publication manifests remain readable only.")
|
|
76
|
+
_register("RECIPE_TYPES_INVALID", "[recipe] types is a non-empty list of distinct Job types from bench, sandbox, train and inference.")
|
|
75
77
|
_register("RECIPE_PARAMS_INVALID", "Each [params.NAME] uses type, default, required, description, enum, minimum, maximum or locked (object params also properties and additional_properties); names are lowercase snake_case. Recipe image accepts only a default pinned with @sha256:<digest> and optional description. command, timeout_seconds and max_retries cannot be declared by a Recipe.")
|
|
76
78
|
_register("RECIPE_PARAM_CONFLICT", "A Recipe param may only narrow the Runner's declaration of the same name: same type, tighter range, enum subset, keep Runner locks and required params. Relax the Recipe declaration.")
|
|
77
79
|
_register("RECIPE_INPUTS_INVALID", "Each [inputs.SLOT] has kind (dataset, checkpoint or artifact) and required (true or false); slot names are lowercase, and train_dataset / eval_dataset must be datasets, checkpoint / resume_from_checkpoint checkpoints.")
|
|
78
80
|
_register("RECIPE_OUTPUTS_INVALID", "[outputs] files lists distinct relative paths under $ENVLOOP_OUTPUT_DIR; result.json is always produced and is not listed.")
|
|
79
81
|
_register("RECIPE_AGENT_DEFINITION_NOT_FOUND", "[agent] definition must name a JSON file selected by [source].paths.")
|
|
80
82
|
_register("RECIPE_SOURCE_INVALID RECIPE_SOURCE_MISMATCH", "[source] repository is optional: omit it for a local-only Git repository, or give https://github.com/OWNER/REPO. It is recorded as provenance only and never fetched.")
|
|
81
|
-
_register("RECIPE_INDEX_INVALID RECIPE_INTEGRITY RECIPE_FILE_NOT_SELECTED RECIPE_DEPENDENCY_MISMATCH", "The uploaded Recipe files do not match their content index. Rebuild and publish with el
|
|
83
|
+
_register("RECIPE_INDEX_INVALID RECIPE_INTEGRITY RECIPE_FILE_NOT_SELECTED RECIPE_DEPENDENCY_MISMATCH", "The uploaded Recipe files do not match their content index. Rebuild and publish with el recipe create --directory DIR instead of a hand-written manifest.")
|
|
82
84
|
_register("RECIPE_ABI_MISMATCH", "The Job's Runner Revision does not implement the Recipe ABI envloop.recipe/1. Use a Runner Revision that does, or a Recipe published for this Runner's ABI.")
|
|
83
85
|
_register("RECIPE_TYPE_UNSUPPORTED", "The Job type must be listed in both the Runner's and the Recipe's types. Submit a supported --type or add the type to [recipe] types.")
|
|
84
86
|
_register("RECIPE_PARAM_REQUIRED RUNNER_PARAM_REQUIRED", "A required param has no value. Set it under params in the Job spec (or the Profile); required params never get a default.")
|
|
85
87
|
_register("RECIPE_REVISION_INVALID", "Use a local branch or tag name, or the full lowercase 40- or 64-character commit, as --revision.")
|
|
86
88
|
_register("RECIPE_REVISION_UNRESOLVED", "--revision names no local branch, tag or commit in the Git checkout that holds --directory, or Git is unavailable. Fetch it, or pass the full commit.")
|
|
87
89
|
_register("RECIPE_PACKAGE_UNCOMMITTED", "recipe.toml or a packaged path differs from the --revision branch or tag: it has uncommitted changes or untracked files that would not be published. Commit them, or pass a full commit to publish exactly that commit.")
|
|
88
|
-
_register("RECIPE_READBACK_MISMATCH", "The platform catalog did not return this Recipe as ready with the published manifest digest. Read it with el
|
|
89
|
-
_register("RECIPE_PACKAGE_UNSUPPORTED", "The installed envloop-envhub cannot build Recipe packages. Upgrade envloop-cli[
|
|
90
|
-
_register("DATASET_REQUIRED", "Missing Dataset input (--dataset or --source) for this
|
|
90
|
+
_register("RECIPE_READBACK_MISMATCH", "The platform catalog did not return this Recipe as ready with the published manifest digest. Read it with el recipe list --ref URI before retrying.")
|
|
91
|
+
_register("RECIPE_PACKAGE_UNSUPPORTED", "The installed envloop-envhub cannot build Recipe packages. Upgrade envloop-cli[asset] to a release that includes it.")
|
|
92
|
+
_register("DATASET_REQUIRED", "Missing Dataset input (--dataset or --source) for this Bench Job.")
|
|
91
93
|
_register("DATASET_CONFIG_REQUIRED", "An explicit Dataset configuration (--config) is required.")
|
|
92
94
|
_register("RUNNER_REQUIRED", "Missing Runner input (--runner) for this Job.")
|
|
93
95
|
_register("RUNNER_SELECTOR_REQUIRED", "An explicit Runner revision (--runner) is required.")
|
|
@@ -108,8 +110,8 @@ _register("FILE_EXISTS", "The destination already exists.")
|
|
|
108
110
|
_register("FILE_ERROR", "A local file could not be read or written.")
|
|
109
111
|
_register("INVALID_JSON", "The request file is not valid JSON.")
|
|
110
112
|
_register("INVALID_INPUT", "The request or input is invalid.")
|
|
111
|
-
_register("
|
|
112
|
-
_register("
|
|
113
|
+
_register("ASSET_FILE_REQUIRED", "This resource has several files. Download one with --file FILE_ID; its files are listed below.")
|
|
114
|
+
_register("ASSET_FILE_UNAVAILABLE", "This resource has no downloadable file yet. Check its status with `the matching resource get REF`.")
|
|
113
115
|
_register("INVALID_API_KEY", "The supplied API key has an invalid format.")
|
|
114
116
|
_register("API_URL_REQUIRED INVALID_API_URL", "The API Base URL is missing or invalid.")
|
|
115
117
|
_register("PROJECT_REQUIRED PROJECT_SCOPE_REQUIRED", "This operation requires a project scope.")
|
|
@@ -120,6 +122,7 @@ _register("REGISTRY_CREDENTIAL_EXISTS", "This project already has a credential f
|
|
|
120
122
|
_register("REGISTRY_CREDENTIAL_LIMIT", "The project reached its registry credential limit. Remove an unused credential first.")
|
|
121
123
|
_register("INVALID_REGISTRY_CREDENTIAL", "Use a registry host such as ghcr.io, a repository prefix such as my-org, a username without ':' and a non-empty token.")
|
|
122
124
|
_register("REGISTRY_CREDENTIALS_UNAVAILABLE", "Registry credentials are unavailable on this deployment. Retry later or contact the platform operator.")
|
|
125
|
+
_register("REGISTRY_CREDENTIAL_SCOPE_REQUIRED", "This API key does not carry registry_credentials.write, and existing keys never gain permissions. Only a key issued by el auth login can manage registry credentials: as a project Admin, run el auth login again, then retry.")
|
|
123
126
|
_register("CONCURRENCY_ABOVE_CEILING", "The limit is above the ceiling the platform operator set for this project. Check `el limit get`.")
|
|
124
127
|
_register("INVALID_CONCURRENCY_LIMIT", "Use a whole number from 1 to 10000, or none to clear the project limit.")
|
|
125
128
|
_register("INVALID_PROJECT_ID INVALID_WORKSPACE_ID", "The workspace or project ID has an invalid format.")
|
|
@@ -144,19 +147,29 @@ _register("PROFILE_RUNNER_UNSUPPORTED", "This submission path cannot execute the
|
|
|
144
147
|
_register("PROFILE_ARCHIVED PROFILE_HASH_MISMATCH", "The selected Profile is archived or does not match its frozen version.")
|
|
145
148
|
_register("NAMED_PROFILE_INVALID PROFILE_INPUT_INVALID PROFILE_CHECKPOINT_MODEL_MISMATCH", "The named Profile or input binding is incompatible. Use its declared input slots and allowed parameter replacements.")
|
|
146
149
|
_register("PROFILE_AUTHORIZATION_UNAVAILABLE", "Current Profile authorization could not be verified. Retry the same request after authorization is available.")
|
|
147
|
-
_register("VISIBILITY_CONFLICT", "
|
|
148
|
-
_register("VISIBILITY_INVALID", "Choose private, internal or public with a nonnegative --expected-acl-revision
|
|
150
|
+
_register("VISIBILITY_CONFLICT", "Read the asset again with its resource get command, then retry set-visibility with the current --expected-acl-revision.")
|
|
151
|
+
_register("VISIBILITY_INVALID", "Choose private, internal or public with a nonnegative --expected-acl-revision. Profile supports private and public.")
|
|
152
|
+
_register("ASSET_ACL_UNSUPPORTED", "A metadata-only Hugging Face model registration stays readable in the project that registered it. Register it in each project that needs it.")
|
|
153
|
+
_register("ASSET_REFERENCE_AMBIGUOUS", "Several readable assets match this reference. Retry with the asset ID for the copy you want.")
|
|
149
154
|
_register("RECIPE_GRANTS_UNAVAILABLE", "Recipe sharing could not be checked for this request. This is temporary; retry the same request.")
|
|
150
155
|
_register("RECIPE_GRANTS_LIMIT", "This project can read more shared Recipe names than the platform can apply to one request. Retrying will not help; contact a platform operator.")
|
|
151
156
|
_register("VISIBILITY_PUBLIC_REQUIRES_ADMIN", "Only a platform administrator can make a resource public or withdraw public visibility; API keys never act as platform administrators. Use private or internal (this workspace), or ask a platform administrator.")
|
|
152
|
-
_register("RUNNER_REVISION_AMBIGUOUS", "Several projects share different content under this Runner revision. Publish your own copy in this project with el runner create (your copy takes precedence), or ask the owning project to set theirs private with
|
|
157
|
+
_register("RUNNER_REVISION_AMBIGUOUS", "Several projects share different content under this Runner revision. Publish your own copy in this project with el runner create (your copy takes precedence), or ask the owning project to set theirs private with the owning resource set-visibility.")
|
|
153
158
|
_register("CHECKPOINT_REVISION_AMBIGUOUS", "Several projects share different checkpoints under this URI. Copy the one you need into this project (your copy takes precedence), or ask the owning project to set theirs private with el checkpoint set-visibility.")
|
|
154
|
-
_register("DATASET_REVISION_AMBIGUOUS", "Several projects share different content under this Dataset version. el
|
|
155
|
-
_register("DATASET_NAMESPACE_UNAVAILABLE", "This registration ran while Dataset namespaces were still reserved or claimed across projects. Datasets are now stored per project and no namespace is reserved: register the same snapshot again (el
|
|
159
|
+
_register("DATASET_REVISION_AMBIGUOUS", "Several projects share different content under this Dataset version. el dataset list shows the entry as unavailable with the asset_id of each readable copy under CANDIDATES (--json adds owners and digests); select one copy by passing that asset_id as --dataset ASSET_ID or --input SLOT=ASSET_ID. Or pass another explicit NAME@VERSION, publish your own copy in this project with el dataset create (your copy takes precedence), or ask the owning project to set theirs private with the owning resource set-visibility.")
|
|
160
|
+
_register("DATASET_NAMESPACE_UNAVAILABLE", "This registration ran while Dataset namespaces were still reserved or claimed across projects. Datasets are now stored per project and no namespace is reserved: register the same snapshot again (el dataset registration create PUBLICATION_ID --runner NAME@REVISION).")
|
|
156
161
|
_register("RESOURCE_IN_USE", "Remove or release the listed references first. A reference listed with a workspace and project belongs to another project that froze your shared copy (for example an endpoint or adapter holding a checkpoint); ask that project to delete or release it. Narrowing visibility does not release a frozen reference.")
|
|
157
|
-
_register("PUBLIC_DEPENDENCY_UNAVAILABLE", "A shared resource needs dependencies at least as readable as itself: a public Recipe needs public dependencies, and an internal Recipe needs dependencies readable in this workspace (internal or public). Change the dependencies' visibility first (
|
|
162
|
+
_register("PUBLIC_DEPENDENCY_UNAVAILABLE", "A shared resource needs dependencies at least as readable as itself: a public Recipe needs public dependencies, and an internal Recipe needs dependencies readable in this workspace (internal or public). Change the dependencies' visibility first (the owning resource set-visibility ASSET_ID), then retry; private dependencies are never shared automatically.")
|
|
158
163
|
_register("PUBLIC_CONTENT_UNSAFE PUBLICATION_REVIEW_REQUIRED", "Content review failed for one of this name's current revisions, so it cannot be shared. Fix or retire the flagged revision, then retry.")
|
|
159
164
|
_register("CHECKPOINT_AMBIGUOUS", "More than one checkpoint matches this selection.")
|
|
165
|
+
_register("CHECKPOINT_UPLOAD_UNAVAILABLE", "The platform checkpoint upload service is unavailable. Ask a platform operator to check the upload service and temporary-credential configuration, then let the worker retry.")
|
|
166
|
+
_register("CHECKPOINT_UPLOAD_FORBIDDEN", "Checkpoint publication requires the current Train worker's platform-issued credential in its own workspace and project. Check the worker connection and checkpoints.write permission.")
|
|
167
|
+
_register("CHECKPOINT_UPLOAD_CLOSED", "The checkpoint upload session or its producing Trial is no longer open for publication. Check the Trial state and worker credential expiry; a stopped Trial cannot publish.")
|
|
168
|
+
_register("CHECKPOINT_UPLOAD_INVALID", "The platform rejected the checkpoint descriptor or file inventory. Check --result and --directory against the saved train-result/v1 and output files.")
|
|
169
|
+
_register("CHECKPOINT_UPLOAD_INCOMPLETE", "Uploaded checkpoint files are missing or do not match the declared inventory. Keep the saved files unchanged and retry publication from the worker.")
|
|
170
|
+
_register("CHECKPOINT_FROZEN_MODEL_MISMATCH", "The checkpoint base model or revision differs from the producing Job's frozen input. Check the saved result against that Job's model and revision.")
|
|
171
|
+
_register("CHECKPOINT_REVISION_CONFLICT MODEL_REVISION_OWNED", "The checkpoint identity already belongs to different content or another Job. Publish under a new model revision; existing checkpoint content cannot be overwritten.")
|
|
172
|
+
_register("CHECKPOINT_STORAGE_UPLOAD_FAILED", "Checkpoint file transfer to object storage failed. Publication is not confirmed. Check the worker's storage connectivity and let it retry the same saved checkpoint.")
|
|
160
173
|
_register("CHECKPOINT_FILES_UNAVAILABLE ARTIFACT_NOT_READY", "The requested download is not available yet.")
|
|
161
174
|
_register("CHECKPOINT_FILES_INVALID ARTIFACT_LISTING_INVALID ARTIFACT_NAME_UNSAFE UNSAFE_ARTIFACT_REDIRECT ARTIFACT_SIZE_MISMATCH ARTIFACT_HASH_MISMATCH", "The download failed a safety or integrity check.")
|
|
162
175
|
_register("ARTIFACT_DOWNLOAD_FAILED", "The artifact download service rejected the request.")
|
|
@@ -177,7 +190,7 @@ _register("RSI_CONFLICT RSI_LOOP_NOT_ACTIVE", "A Loop with this name exists, the
|
|
|
177
190
|
_register("RSI_CONTROL_UNCONFIGURED RSI_CONTROL_UNAVAILABLE RSI_CONTROL_TIMEOUT", "The RSI loop service is not available through this platform right now.")
|
|
178
191
|
|
|
179
192
|
_register("UNSUPPORTED_ADAPTER_SOURCE", 'Register a training checkpoint with {"serving_profile": "NAME", "source": {"type": "train_checkpoint", "uri": "envloop://..."}}. '
|
|
180
|
-
"List
|
|
193
|
+
"List Checkpoints with `el checkpoint list`.")
|
|
181
194
|
_register("JOB_ACTION_UNSUPPORTED", "This Job type does not support the requested action.")
|
|
182
195
|
_register("INFERENCE_ROUTE_RETIRED", "The global inference route has been retired.")
|
|
183
196
|
|
|
@@ -281,7 +294,7 @@ def _http_message(status: int | None) -> str:
|
|
|
281
294
|
return _MESSAGES["HTTP_ERROR"]
|
|
282
295
|
|
|
283
296
|
|
|
284
|
-
_OWN_PACKAGES = frozenset({"envloop", "
|
|
297
|
+
_OWN_PACKAGES = frozenset({"envloop", "envloop_asset", "envloop_experiment", "envloop_rsi_loop"})
|
|
285
298
|
|
|
286
299
|
|
|
287
300
|
def validation_message(error: BaseException) -> str | None:
|
|
@@ -307,14 +320,14 @@ def validation_message(error: BaseException) -> str | None:
|
|
|
307
320
|
|
|
308
321
|
def safe_error_code(error: Any) -> str:
|
|
309
322
|
"""Select a trusted CLI/report identifier without changing the SDK error."""
|
|
310
|
-
from ._optional import
|
|
323
|
+
from ._optional import missing_feature
|
|
311
324
|
from .config import ConfigError
|
|
312
325
|
from .downloads import ArtifactError
|
|
313
326
|
from .profile_secrets import InvalidProfileSecrets
|
|
314
327
|
from .resources import CleanupError
|
|
315
328
|
|
|
316
|
-
if
|
|
317
|
-
return
|
|
329
|
+
if (feature := missing_feature(error)) is not None:
|
|
330
|
+
return feature.code
|
|
318
331
|
if isinstance(error, CleanupError):
|
|
319
332
|
code = "CLEANUP_INCOMPLETE"
|
|
320
333
|
elif isinstance(error, (RemoteError, ConfigError, ArtifactError, InvalidProfileSecrets)) or type(error).__module__ == 'envloop_rsi_loop.loops':
|
|
@@ -373,9 +386,9 @@ def error_block(code: str, message: str, *, status: int | None = None, guidance:
|
|
|
373
386
|
|
|
374
387
|
def format_error(error: BaseException) -> str:
|
|
375
388
|
"""Render a human error; SDK exception attributes remain unchanged."""
|
|
376
|
-
from ._optional import
|
|
377
|
-
if
|
|
378
|
-
return error_block(
|
|
389
|
+
from ._optional import missing_feature
|
|
390
|
+
if (feature := missing_feature(error)) is not None:
|
|
391
|
+
return error_block(feature.code, str(feature))
|
|
379
392
|
code = safe_error_code(error)
|
|
380
393
|
remote = error if isinstance(error, RemoteError) else None
|
|
381
394
|
candidate = remote and remote.status_code
|
|
@@ -416,9 +429,9 @@ def upload_recovery(error: BaseException) -> str:
|
|
|
416
429
|
lines.append(' Retirement is pending; retry deletion of the same resource to complete it.')
|
|
417
430
|
upload_id = getattr(error, 'upload_id', None)
|
|
418
431
|
if isinstance(upload_id, str) and re.fullmatch(r'upload_[a-f0-9]{32}', upload_id):
|
|
419
|
-
lines.extend([f' Upload retained: {upload_id}', f' Inspect with:
|
|
432
|
+
lines.extend([f' Upload retained: {upload_id}', f' Inspect with: RESOURCE upload get {upload_id}'])
|
|
420
433
|
if running:
|
|
421
|
-
lines.append(f' Poll publication with:
|
|
434
|
+
lines.append(f' Poll publication with: RESOURCE upload complete {upload_id}')
|
|
422
435
|
generated = getattr(error, 'generated_idempotency_key', None)
|
|
423
436
|
# A definite refusal (permission, validation, not found) fails the same way again; offer the key only
|
|
424
437
|
# when the outcome is unknown or retryable.
|
envloop/cli_output.py
CHANGED
|
@@ -50,7 +50,7 @@ def next_page(args: argparse.Namespace, cursor: object, program: str) -> str:
|
|
|
50
50
|
if getattr(args, 'no_color', False):
|
|
51
51
|
command.append('--no-color')
|
|
52
52
|
from ._optional import feature_module
|
|
53
|
-
feature = '
|
|
53
|
+
feature = 'asset' if args.group in {'recipe', 'dataset', 'runner', 'checkpoint', 'profile'} else 'experiment' if args.group in {'job', 'trial'} else None
|
|
54
54
|
if feature is not None:
|
|
55
55
|
feature_module(feature, 'cli_output').pagination(command, args, cursor)
|
|
56
56
|
else:
|
|
@@ -62,10 +62,12 @@ def next_page(args: argparse.Namespace, cursor: object, program: str) -> str:
|
|
|
62
62
|
|
|
63
63
|
# Empty-list text names the listed resource, not the command group (`job adapter list` lists adapters).
|
|
64
64
|
EMPTY_RESOURCES = {
|
|
65
|
-
('job', 'adapter'): 'adapters',
|
|
65
|
+
('job', 'adapter'): 'adapters',
|
|
66
66
|
('trial',): 'trials', ('trial', 'artifact'): 'artifacts',
|
|
67
67
|
('dataset',): 'datasets', ('dataset', 'revision'): 'dataset revisions', ('dataset', 'task'): 'dataset tasks',
|
|
68
|
-
('
|
|
68
|
+
('trial', 'artifact', 'file'): 'artifact files',
|
|
69
|
+
('dataset', 'file'): 'dataset files', ('checkpoint', 'file'): 'checkpoint files',
|
|
70
|
+
('recipe', 'file'): 'recipe files', ('runner', 'file'): 'runner files',
|
|
69
71
|
('billing', 'usage'): 'usage records', ('billing', 'ledger'): 'ledger entries', ('billing', 'price'): 'prices',
|
|
70
72
|
('member',): 'members', ('member', 'candidate'): 'member candidates',
|
|
71
73
|
('setting', 'registry'): 'registry credentials',
|
|
@@ -97,7 +99,7 @@ def list_output(result: Any, args: argparse.Namespace, program: str) -> str:
|
|
|
97
99
|
from ._optional import feature_module
|
|
98
100
|
feature = ('rsi-loop' if args.group == 'loop' else
|
|
99
101
|
'experiment' if args.group in {'job', 'trial'} else
|
|
100
|
-
'
|
|
102
|
+
'asset' if args.group in {'recipe', 'dataset', 'runner', 'checkpoint', 'profile'} else None)
|
|
101
103
|
if feature is not None:
|
|
102
104
|
headers, render, empty = feature_module(feature, 'cli_output').list_layout(items, args)
|
|
103
105
|
else:
|
|
@@ -107,7 +109,7 @@ def list_output(result: Any, args: argparse.Namespace, program: str) -> str:
|
|
|
107
109
|
'billing': ('entry_id', 'kind', 'product', 'day', 'endpoint_id', 'sku', 'amount_usd', 'gpu_seconds', 'reference', 'occurred_at'),
|
|
108
110
|
})
|
|
109
111
|
output = table(headers, [render(item) for item in items]) if items else empty
|
|
110
|
-
if feature
|
|
112
|
+
if feature in {'asset','experiment'}:
|
|
111
113
|
output = feature_module(feature, 'cli_output').observed_output(output, result, args)
|
|
112
114
|
cursor = result.get('next_cursor')
|
|
113
115
|
if cursor is not None:
|
|
@@ -117,6 +119,6 @@ def list_output(result: Any, args: argparse.Namespace, program: str) -> str:
|
|
|
117
119
|
|
|
118
120
|
def __getattr__(name: str) -> Any:
|
|
119
121
|
from ._optional import feature_attribute
|
|
120
|
-
feature = ('
|
|
122
|
+
feature = ('asset' if name in {'profile_row', 'dataset_row'} else
|
|
121
123
|
'experiment' if name == 'job_row' else 'rsi-loop')
|
|
122
124
|
return feature_attribute(feature, 'cli_output', name)
|
envloop/client.py
CHANGED
|
@@ -67,7 +67,7 @@ class Client:
|
|
|
67
67
|
def init_repository(root: str | Path) -> None:
|
|
68
68
|
"""Explicitly initialize the repository-local registry, without changing Git."""
|
|
69
69
|
with Client.local() as client:
|
|
70
|
-
client.
|
|
70
|
+
client._transport.init_repository(root)
|
|
71
71
|
|
|
72
72
|
def close(self) -> None:
|
|
73
73
|
if self._owned_server is not None:
|
envloop/downloads.py
CHANGED
|
@@ -44,7 +44,9 @@ def download_file(open_source: Callable[[], AbstractContextManager[BinaryIO]], i
|
|
|
44
44
|
if (size is not None and (type(size) is not int or size < 0)
|
|
45
45
|
or expected is not None and not re.fullmatch(r"[0-9a-f]{64}", str(expected))):
|
|
46
46
|
raise ArtifactError("ARTIFACT_LISTING_INVALID")
|
|
47
|
-
if
|
|
47
|
+
identity_field = 'artifact_id' if item.get('artifact_id') else 'artifact_ref'
|
|
48
|
+
identity = item.get(identity_field)
|
|
49
|
+
if not isinstance(identity, str) or not identity:
|
|
48
50
|
raise ArtifactError("ARTIFACT_NOT_READY")
|
|
49
51
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
50
52
|
descriptor, partial = tempfile.mkstemp(dir=target.parent, prefix=f".{target.name}.", suffix=".part")
|
|
@@ -66,6 +68,6 @@ def download_file(open_source: Callable[[], AbstractContextManager[BinaryIO]], i
|
|
|
66
68
|
except BaseException:
|
|
67
69
|
Path(partial).unlink(missing_ok=True)
|
|
68
70
|
raise
|
|
69
|
-
logger.info("artifact.downloaded
|
|
70
|
-
return {
|
|
71
|
+
logger.info("artifact.downloaded %s=%s size=%s", identity_field, identity, received)
|
|
72
|
+
return {identity_field: identity, "name": item["name"], "path": str(target),
|
|
71
73
|
"size": received, "sha256": digest.hexdigest()}
|
envloop/http.py
CHANGED
|
@@ -28,7 +28,7 @@ def validate_public_execution(value: Any, *, allow_local_sandbox: bool = True) -
|
|
|
28
28
|
spec = value.get("spec")
|
|
29
29
|
if any(key in value for key in RESOLVED_OWNER_FIELDS) or isinstance(spec, dict) and any(key in spec for key in RESOLVED_OWNER_FIELDS):
|
|
30
30
|
raise ValueError("the owning project of each input is resolved by the platform; select a Dataset copy by its "
|
|
31
|
-
"
|
|
31
|
+
"asset_id and remove dataset_owners, checkpoint_owners, checkpoint_owner and runner_owner")
|
|
32
32
|
if any(key in value for key in ("executor", "backend")):
|
|
33
33
|
raise ValueError("execution backend is configured by the server")
|
|
34
34
|
if "provider" in value and not (allow_local_sandbox and value.get("type") == "sandbox" and value["provider"] == "local"):
|
|
@@ -145,14 +145,16 @@ def _text(value: Any, limit: int, secrets: tuple[str | None, ...] = ()) -> str |
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
_DETAIL_TEXT = frozenset({"field", "loc", "name", "message", "msg", "error"})
|
|
148
|
+
_DETAIL_FIELD, _DETAIL_MESSAGE, _DETAIL_TOTAL = 300, 700, 4000
|
|
148
149
|
|
|
149
150
|
|
|
150
151
|
def _detail_lines(value: Any, secrets: tuple[str | None, ...]) -> list[str]:
|
|
151
|
-
"""Field-level validation detail from `fields`/`details`, as at most
|
|
152
|
+
"""Field-level validation detail from `fields`/`details`, as at most 20 bounded lines."""
|
|
152
153
|
if isinstance(value, dict):
|
|
153
154
|
value = [{"field": key, "message": item} for key, item in value.items()]
|
|
154
|
-
lines = []
|
|
155
|
-
|
|
155
|
+
lines: list[str] = []
|
|
156
|
+
total = 0
|
|
157
|
+
for item in value[:20] if isinstance(value, list) else []:
|
|
156
158
|
if isinstance(item, dict):
|
|
157
159
|
field = item.get("field") or item.get("loc") or item.get("name")
|
|
158
160
|
field = ".".join(map(str, field)) if isinstance(field, list) else field
|
|
@@ -162,10 +164,19 @@ def _detail_lines(value: Any, secrets: tuple[str | None, ...]) -> list[str]:
|
|
|
162
164
|
pairs = ", ".join(f"{key}={value}" for key, value in list(item.items())[:16]
|
|
163
165
|
if isinstance(key, str) and key not in _DETAIL_TEXT
|
|
164
166
|
and isinstance(value, (str, int, float)) and not isinstance(value, bool))
|
|
165
|
-
located = f"{field} ({pairs})" if field and pairs else field
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
located = f"{field} ({pairs})" if field and pairs else str(field) if field else None
|
|
168
|
+
located = _text(located, _DETAIL_FIELD, secrets)
|
|
169
|
+
message = _text(str(message) if message else None, _DETAIL_MESSAGE, secrets)
|
|
170
|
+
line = f"{located}: {message}" if located and message else message or located or _text(pairs, _DETAIL_FIELD, secrets)
|
|
171
|
+
else:
|
|
172
|
+
line = _text(item, _DETAIL_MESSAGE, secrets)
|
|
173
|
+
if not line:
|
|
174
|
+
continue
|
|
175
|
+
if total + len(line) > _DETAIL_TOTAL:
|
|
176
|
+
lines.append("… further details omitted")
|
|
177
|
+
break
|
|
178
|
+
total += len(line)
|
|
179
|
+
lines.append(line)
|
|
169
180
|
return lines
|
|
170
181
|
|
|
171
182
|
|
|
@@ -214,6 +225,14 @@ def error_fields(error: HTTPError, secrets: tuple[str | None, ...] = ()) -> dict
|
|
|
214
225
|
result['retirement_pending'] = True
|
|
215
226
|
if dependencies := _dependency_lines(pick('dependencies'), secrets):
|
|
216
227
|
result['details'] = [*result['details'], *dependencies][:20]
|
|
228
|
+
if code == "ASSET_REFERENCE_AMBIGUOUS":
|
|
229
|
+
candidates = pick("candidates")
|
|
230
|
+
for candidate in candidates[:10] if isinstance(candidates, list) else []:
|
|
231
|
+
asset_id = candidate.get("asset_id") if isinstance(candidate, dict) else None
|
|
232
|
+
if isinstance(asset_id, str) and re.fullmatch(r"[A-Za-z0-9_-]{1,256}", asset_id):
|
|
233
|
+
line = _text(f"Candidate asset ID {asset_id}", 280, secrets)
|
|
234
|
+
if line and len(result["details"]) < 20:
|
|
235
|
+
result["details"].append(line)
|
|
217
236
|
return result
|
|
218
237
|
|
|
219
238
|
|
|
@@ -382,7 +401,7 @@ class HttpService:
|
|
|
382
401
|
except HTTPError as error:
|
|
383
402
|
if error.code in REDIRECT_STATUSES:
|
|
384
403
|
error.close()
|
|
385
|
-
raise RemoteError('
|
|
404
|
+
raise RemoteError('ASSET_REDIRECT_REJECTED', error.code) from None
|
|
386
405
|
raise self.remote_error(error, method='GET', retry_after=retry_after_seconds(error.headers.get('Retry-After'))) from None
|
|
387
406
|
except (URLError, TimeoutError, OSError, InvalidURL, HTTPException) as error:
|
|
388
407
|
raise transport_error(error) from None
|