envloop-cli 2.0.0__py3-none-any.whl → 2.2.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/cli.py +3 -0
- envloop/cli_errors.py +5 -2
- envloop/http.py +10 -8
- envloop_asset/assets.py +15 -6
- envloop_asset/cli_output.py +2 -2
- envloop_asset/client.py +24 -20
- envloop_asset/direct_checkpoint.py +41 -3
- envloop_asset/direct_publication.py +43 -5
- envloop_asset/direct_storage.py +6 -2
- envloop_asset/recipe_packages.py +2 -2
- envloop_asset/resource_cli.py +7 -17
- envloop_asset/runner_packages.py +27 -4
- envloop_asset/tags.py +20 -0
- envloop_asset/transfer.py +148 -21
- envloop_chat/__init__.py +1 -0
- envloop_chat/cli.py +116 -0
- envloop_chat/client.py +146 -0
- {envloop_cli-2.0.0.dist-info → envloop_cli-2.2.0.dist-info}/METADATA +38 -28
- {envloop_cli-2.0.0.dist-info → envloop_cli-2.2.0.dist-info}/RECORD +26 -23
- envloop_experiment/cli.py +14 -5
- envloop_experiment/client.py +23 -10
- envloop_experiment/http.py +1 -2
- envloop_experiment/job_spec_cli.py +6 -3
- envloop_experiment/named_profile.py +5 -1
- {envloop_cli-2.0.0.dist-info → envloop_cli-2.2.0.dist-info}/WHEEL +0 -0
- {envloop_cli-2.0.0.dist-info → envloop_cli-2.2.0.dist-info}/entry_points.txt +0 -0
|
@@ -3,13 +3,13 @@ envloop/_optional.py,sha256=u3BAnO7_POlD3b5ZK3iDXJwefe7MySSj4DcoOqaQGPk,9799
|
|
|
3
3
|
envloop/auth_cli.py,sha256=xxMxvsBeeIRht0fWaXSV7tstMKlCzqBBVBcXEvNpwGU,17874
|
|
4
4
|
envloop/auth_login.py,sha256=uOqPHqgzi0Y5eDMiZJH-EI_HxY55F9bRr8CoBb8OHfk,7231
|
|
5
5
|
envloop/auth_workspace.py,sha256=g92Dok4eSp6P-Du5qkwzZG4JDeSrdYTXJbn5WCzCFMo,14927
|
|
6
|
-
envloop/cli.py,sha256=
|
|
7
|
-
envloop/cli_errors.py,sha256=
|
|
6
|
+
envloop/cli.py,sha256=aOgpG-JnBvjviBOizqgQQhm8by8EZvSJblNKebLhTVc,16165
|
|
7
|
+
envloop/cli_errors.py,sha256=sXVeYa5LRuV4RsQE7vdoY5CHcTIwnAgEvVb9V_UiS_I,48330
|
|
8
8
|
envloop/cli_output.py,sha256=s5LwMHhDIbD6cqvmRYvIFTkgGehbUe4NJcmf6R-8BV0,6135
|
|
9
9
|
envloop/client.py,sha256=Bj0oY1NPPRWpf5IOnXmoWKIKPXusUsrMK-IXOwcEgME,3293
|
|
10
10
|
envloop/config.py,sha256=1Wr2lNdNNZzsQDPNGsk-TsnEUvDqOtocy9TgUpmOZO0,22494
|
|
11
11
|
envloop/downloads.py,sha256=ADeNSbiWBOwOxQ19w-KRwdSzvsiPKy1ZT7s9BR_jf-s,3335
|
|
12
|
-
envloop/http.py,sha256=
|
|
12
|
+
envloop/http.py,sha256=MAlhC7pVfMrSU1B-VWGLW9Svxek0aBTTXbhrt09LWrc,21642
|
|
13
13
|
envloop/lifecycle_cli.py,sha256=YwudbcpolVdYOcNcyCztTEEJOWUXNqDqHSjJCNDILvg,7814
|
|
14
14
|
envloop/navigation_resources.py,sha256=vH9jmrfiYARl5kugFAgWzH2b5NXo5SxEi8X0OAyT6jQ,10382
|
|
15
15
|
envloop/profile_secrets.py,sha256=A0i-mB7Mg3qclqQAtJXjvOcYnwvMyURwR8tubBh4R0E,9636
|
|
@@ -19,17 +19,17 @@ envloop/terminal.py,sha256=YcUXw0qfLki0I10Ul3nF73pylq-OJ4SJMPh_FMV0kZE,3698
|
|
|
19
19
|
envloop/utils/__init__.py,sha256=huB3qPQuKNr3JxfH3Ys09YWFtHiDamCHFsBa4epANgQ,25
|
|
20
20
|
envloop/utils/logging.py,sha256=rXN0qyxhfGEq4vWXxjwfaczPPZf_7atnOkkBTgNNRPc,1017
|
|
21
21
|
envloop_asset/__init__.py,sha256=nKDGmzFNAQv2mq16YijiI3Q-gDL_smNyZD-AQaqoz7Y,68
|
|
22
|
-
envloop_asset/assets.py,sha256=
|
|
22
|
+
envloop_asset/assets.py,sha256=12S_SP5GY-4Sf1dyBaFA_gHEUEwu8qq784yORC3YlG8,32127
|
|
23
23
|
envloop_asset/checkpoint_download.py,sha256=86pq8IXoJCEP6dVaLtgocp8b8rTyuEccK_ecOQLGiec,4622
|
|
24
24
|
envloop_asset/checkpoint_upload.py,sha256=BwvLDb862B15MJGjr1lTTu8H6GIyDN5wsVcyoD30WRA,5317
|
|
25
25
|
envloop_asset/cli.py,sha256=mISKgX1xz6UjSwP_4TQeOm89ugmcKctsZUC9DpWpcIw,3776
|
|
26
|
-
envloop_asset/cli_output.py,sha256=
|
|
27
|
-
envloop_asset/client.py,sha256=
|
|
26
|
+
envloop_asset/cli_output.py,sha256=XKw5LRuQdorldl2ifJr-R1FDRJbSD2vthGz9GhIWw_U,5637
|
|
27
|
+
envloop_asset/client.py,sha256=xuUdlMDB5NcBbECVgyMADg3zbDYu4s0S4RLQxgJwqLc,20461
|
|
28
28
|
envloop_asset/dataset_upload.py,sha256=G1lwQvqsqD5d-U80hYzCb83dvfPz73Yg4_7JKh3Mrys,19574
|
|
29
29
|
envloop_asset/direct_artifact.py,sha256=1564EPw64MbGiUfMGRFfqHvyocxwA0gx1V5lhaH-jhM,10774
|
|
30
|
-
envloop_asset/direct_checkpoint.py,sha256=
|
|
31
|
-
envloop_asset/direct_publication.py,sha256=
|
|
32
|
-
envloop_asset/direct_storage.py,sha256=
|
|
30
|
+
envloop_asset/direct_checkpoint.py,sha256=sL00wpBfax75G5hYzwJimZ4hE2BeRbpOUntzWEoM9Yw,8718
|
|
31
|
+
envloop_asset/direct_publication.py,sha256=zKBoAWnR6CGzdvsKS5ZZPLWAFDwiC0VFHLp9TxYE2O4,4103
|
|
32
|
+
envloop_asset/direct_storage.py,sha256=z3dZFlrPUFbLzOWVbN4PS1R_kHYkdJXjvIz0QsJjY70,13207
|
|
33
33
|
envloop_asset/direct_worker_artifact.py,sha256=LS5SuglxglbrkDxbr8AhLvJ5KFS1IWKAG5bprqKcd1Q,4631
|
|
34
34
|
envloop_asset/execution_content.py,sha256=rP_blkZet1ZualA--a7vwZnz1r5jwD87mFtyDN7S3cQ,916
|
|
35
35
|
envloop_asset/http.py,sha256=v0gLHZFnsjaPnx5Jg3I-ktn-O7rCPu8UnB10zEGhMqg,7965
|
|
@@ -38,24 +38,27 @@ envloop_asset/profile_updates.py,sha256=M0KWqznDY6-MPPfjGNeL4FVTR86_yCRq6OyUJc-t
|
|
|
38
38
|
envloop_asset/publication_cli.py,sha256=Ey9e8IxobZyHbYHKB_a5fucYXXZFWjYY4ZpuFdG9gm0,3709
|
|
39
39
|
envloop_asset/publications.py,sha256=Xn794hX1n7nHwqQJzOzlmFFgIlA9h1XNDRAm5DZiBJM,9183
|
|
40
40
|
envloop_asset/r2_upload.py,sha256=m-L1Z7L7fQvJNVA9pGzwSGGOTv1_COC5OVSjUIQfxMU,1605
|
|
41
|
-
envloop_asset/recipe_packages.py,sha256=
|
|
41
|
+
envloop_asset/recipe_packages.py,sha256=HA7RT2T6Lt94cl5_4ye3wPxxQd8lCo2_HdAeuq3yQvQ,5957
|
|
42
42
|
envloop_asset/recipes.py,sha256=We2TZWdRl-ialV-uLFvUSvJng9P2HGquqGtqKYKllgs,1442
|
|
43
|
-
envloop_asset/resource_cli.py,sha256=
|
|
44
|
-
envloop_asset/runner_packages.py,sha256=
|
|
45
|
-
envloop_asset/tags.py,sha256=
|
|
46
|
-
envloop_asset/transfer.py,sha256=
|
|
43
|
+
envloop_asset/resource_cli.py,sha256=B6re9EjNy90m2RGMv3nYnYrXdMsGohqSOfzVEY_6e6E,20041
|
|
44
|
+
envloop_asset/runner_packages.py,sha256=ve4UIUBBxoJ6h7LOSpiP6Tox00nak2v6K95hZ0VqvVM,6639
|
|
45
|
+
envloop_asset/tags.py,sha256=wFP0Rg-avOmYkpyYqNGdJrnGreHEli-O5_eH9Liat6c,2016
|
|
46
|
+
envloop_asset/transfer.py,sha256=sXK6kHwI5587OUo3GrFqS7TRpJTR7ytoAxHTIF4OIDk,53233
|
|
47
47
|
envloop_asset/upload_strategy.py,sha256=RP-mNtM4yHQ0YmwocsTKD7MOS2asCoWnI44AtCI9LVw,605
|
|
48
|
+
envloop_chat/__init__.py,sha256=pEW8SHBlrQr2_9UFm45unSUg-GP6rY04V3O27bspOuQ,75
|
|
49
|
+
envloop_chat/cli.py,sha256=aUoflpsBWl-U4vrzZP4xsZrvc0md-zuSsCB6APeIk8Q,5783
|
|
50
|
+
envloop_chat/client.py,sha256=CUCG0jBXJplsXsDNOdu-R-v9O-dVrMMVycNMZUS5b9M,7215
|
|
48
51
|
envloop_experiment/__init__.py,sha256=nKDGmzFNAQv2mq16YijiI3Q-gDL_smNyZD-AQaqoz7Y,68
|
|
49
|
-
envloop_experiment/cli.py,sha256=
|
|
52
|
+
envloop_experiment/cli.py,sha256=kWXlcY_cznUB3D1y6OInkZebjBa0fjQ6V9ciWtkOiAY,43336
|
|
50
53
|
envloop_experiment/cli_output.py,sha256=aM6eajuMDheWb2GA956UE0_y-6_tC0MCdC23ulROHi4,5196
|
|
51
|
-
envloop_experiment/client.py,sha256=
|
|
54
|
+
envloop_experiment/client.py,sha256=XKoeoIz4OZgbLh55CqvZmnWKEcnk-jMsI6XQ9SQHTC8,41757
|
|
52
55
|
envloop_experiment/decision.py,sha256=HJTj-jSJJ5kcxQQzFXwrA9IICWXA6zSNBFL9EbbrxqI,918
|
|
53
|
-
envloop_experiment/http.py,sha256=
|
|
56
|
+
envloop_experiment/http.py,sha256=wQ81Pz_daVRGFDIZQnIgTKRyOWWBgxF8xi4kM9UE6tQ,6970
|
|
54
57
|
envloop_experiment/inference.py,sha256=qSObsdo9suHhG5i_xlCh6-lt-NJkhQzAoF9KzCdVWws,5640
|
|
55
58
|
envloop_experiment/job_cost.py,sha256=gZB69-pdsJM4wManw44AIS9T3ZtsxxQTqrJs-cHjwJU,2214
|
|
56
59
|
envloop_experiment/job_logs.py,sha256=RLipbj89e5hQdBeXtszsxSYYw7By1hscwSTGFQzQ3Qw,1340
|
|
57
|
-
envloop_experiment/job_spec_cli.py,sha256=
|
|
58
|
-
envloop_experiment/named_profile.py,sha256=
|
|
60
|
+
envloop_experiment/job_spec_cli.py,sha256=2q-_Txt0xkeBEjeWfoY9tkWhJnf2ZNhueAk9s4ahNYQ,14468
|
|
61
|
+
envloop_experiment/named_profile.py,sha256=niaJm3WZPH98PNfqpN8RMg18AO5zWTlI88rOnJ2DgSY,9349
|
|
59
62
|
envloop_experiment/navigation_resources.py,sha256=sbatQySVNKftZZ-HKU1mwihoJWaTPYGeLO_dJLr2EHY,1755
|
|
60
63
|
envloop_experiment/resource_cli.py,sha256=BfzQrvaq_Y_EL1OQUSxYtlWhf_SdTwJyU2omxFccn-g,2002
|
|
61
64
|
envloop_experiment/resources.py,sha256=m-kAHFklU9idPg2RtLUoyPBoiIyfl1lECxnu--spdTU,7142
|
|
@@ -72,7 +75,7 @@ envloop_rsi_loop/cli.py,sha256=egat_Keygh9V1VAYgfEmqBKDmntCWe7ES_SFjhh26Yg,4102
|
|
|
72
75
|
envloop_rsi_loop/cli_output.py,sha256=o5XzAkcddBOZ2h_AQ-pUPqJIWUOIMfZPWaPxqm0AtUM,4840
|
|
73
76
|
envloop_rsi_loop/loop_cli.py,sha256=V_LEyWTsps2G1UNuMiWhrDDRdO0H4Z1bXGuWsYTOo0c,4491
|
|
74
77
|
envloop_rsi_loop/loops.py,sha256=MGVe3uXxGlnzT_Sc7OHU97kyYA_FSFpXIUtlpXQ8ha0,8924
|
|
75
|
-
envloop_cli-2.
|
|
76
|
-
envloop_cli-2.
|
|
77
|
-
envloop_cli-2.
|
|
78
|
-
envloop_cli-2.
|
|
78
|
+
envloop_cli-2.2.0.dist-info/METADATA,sha256=GUCA421BzfUTdOAe4-JZgMG2Oe8efr_xa_M_YDroQao,21966
|
|
79
|
+
envloop_cli-2.2.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
80
|
+
envloop_cli-2.2.0.dist-info/entry_points.txt,sha256=8aXOpgtVk4GndhChA4XNecShkb1w0xGHBHrKla78ofI,67
|
|
81
|
+
envloop_cli-2.2.0.dist-info/RECORD,,
|
envloop_experiment/cli.py
CHANGED
|
@@ -112,7 +112,8 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]"):
|
|
|
112
112
|
jobs = groups.add_parser("job", help="Submit and manage Bench, Sandbox, Train and Inference Jobs").add_subparsers(dest="action", required=True)
|
|
113
113
|
job_submit = jobs.add_parser("submit", help="Submit an Bench, Sandbox, Train or Inference Job", allow_abbrev=False)
|
|
114
114
|
job_submit.add_argument("--type", choices=("bench", "sandbox", "train", "inference"), default=None, help="Job type (default: spec type, otherwise bench)")
|
|
115
|
-
job_submit.add_argument("--provider",
|
|
115
|
+
job_submit.add_argument("--provider", metavar="NAME",
|
|
116
|
+
help="Request a Bench/Sandbox provider by name. The connected platform validates the selection.")
|
|
116
117
|
job_submit.add_argument("--image", metavar="IMAGE", help="Sandbox image override (default: registered Runner image); Train Runner: public spelling of --docker")
|
|
117
118
|
from envloop_experiment.train_runner_cli import memory_mebibytes, positive_integer
|
|
118
119
|
|
|
@@ -211,6 +212,8 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]"):
|
|
|
211
212
|
decision.add_argument("job_id", metavar="JOB_ID")
|
|
212
213
|
decision.add_argument("--model", required=True)
|
|
213
214
|
decision.add_argument("--spec", type=Path, required=True, metavar="PAYLOAD.json")
|
|
215
|
+
from envloop_chat.cli import register as register_chat
|
|
216
|
+
register_chat(jobs)
|
|
214
217
|
from envloop_experiment.resource_cli import add_job_resources
|
|
215
218
|
add_job_resources(jobs)
|
|
216
219
|
listing = jobs.add_parser("list")
|
|
@@ -294,6 +297,9 @@ def add_commands(groups: "argparse._SubParsersAction[argparse.ArgumentParser]"):
|
|
|
294
297
|
command.add_argument('--json', action='store_true')
|
|
295
298
|
|
|
296
299
|
def validate(args: argparse.Namespace, cli: argparse.ArgumentParser):
|
|
300
|
+
if args.group == 'job' and args.action == 'chat':
|
|
301
|
+
from envloop_chat.cli import prepare
|
|
302
|
+
prepare(args, args._help_parser)
|
|
297
303
|
if args.group == 'trial' and args.action == 'artifact':
|
|
298
304
|
if args.artifact_action == 'download' and (args.trial_id is None) == (args.ref is None):
|
|
299
305
|
cli.error('give exactly one TRIAL_ID or --ref REF')
|
|
@@ -369,8 +375,8 @@ def validate(args: argparse.Namespace, cli: argparse.ArgumentParser):
|
|
|
369
375
|
cli.error('--harbor_env applies only to Bench/Sandbox Jobs')
|
|
370
376
|
if any(key.lower() == 'harbor_env' for key in (getattr(args, 'named_parameters', None) or {})):
|
|
371
377
|
cli.error('--harbor_env and --params cannot both set harbor_env')
|
|
372
|
-
if args.provider is not None and args.type
|
|
373
|
-
cli.error('--provider
|
|
378
|
+
if args.provider is not None and args.type not in {'bench', 'sandbox'}:
|
|
379
|
+
cli.error('--provider requires a Bench/Sandbox Job')
|
|
374
380
|
named_mode = args.spec is None and args.profile is not None and (
|
|
375
381
|
args.type in {'train', 'sandbox'} or args.type == 'bench' and (
|
|
376
382
|
bool(args.input) or all(getattr(args,key,None) is None for key in ('dataset','dataset_option','source','runner','task_id','seed'))))
|
|
@@ -379,7 +385,7 @@ def validate(args: argparse.Namespace, cli: argparse.ArgumentParser):
|
|
|
379
385
|
if named_mode:
|
|
380
386
|
incompatible = ('dataset', 'dataset_option', 'source', 'task_id', 'revision',
|
|
381
387
|
'runner', 'job_id', 'tag', 'priority', 'attempts', 'seed', 'command',
|
|
382
|
-
'image', 'delete_delay_seconds', 'timeout_seconds',
|
|
388
|
+
'image', 'delete_delay_seconds', 'timeout_seconds',
|
|
383
389
|
*(SHORTCUT_FIELDS if args.type == 'train' else TRAIN_ONLY_FIELDS))
|
|
384
390
|
if any(getattr(args, key, None) is not None for key in incompatible):
|
|
385
391
|
cli.error('Named Profiles accept --input with Dataset config/split, --params, --request-id and --max-cost-usd, '
|
|
@@ -393,7 +399,7 @@ def validate(args: argparse.Namespace, cli: argparse.ArgumentParser):
|
|
|
393
399
|
args.named_request = submission(args.profile, type=args.type, inputs=inputs,
|
|
394
400
|
parameters=getattr(args, 'named_parameters', None), request_id=args.request_id,
|
|
395
401
|
budget={'max_cost_usd': args.max_cost_usd} if args.max_cost_usd is not None else None,
|
|
396
|
-
resources=requested_resources(args) or None)
|
|
402
|
+
resources=requested_resources(args) or None, provider=args.provider)
|
|
397
403
|
if args.harbor_env is not None:
|
|
398
404
|
args.named_request['parameters']['harbor_env'] = args.harbor_env
|
|
399
405
|
except (TypeError, ValueError) as exc:
|
|
@@ -551,6 +557,9 @@ def execute_job(args: argparse.Namespace, client: Any, cli: argparse.ArgumentPar
|
|
|
551
557
|
# success, like a failed one; the JSON on stdout says why (error, cost).
|
|
552
558
|
print(json.dumps(result, ensure_ascii=False))
|
|
553
559
|
raise CommandExit(1)
|
|
560
|
+
elif args.action == 'chat':
|
|
561
|
+
from envloop_chat.cli import run
|
|
562
|
+
raise CommandExit(run(args, client))
|
|
554
563
|
elif args.action == "decision":
|
|
555
564
|
result = client.decision.evaluate(args.job_id, model=args.model, payload=args.payload)
|
|
556
565
|
elif args.action == 'resolve':
|
envloop_experiment/client.py
CHANGED
|
@@ -10,7 +10,7 @@ from urllib.parse import urlencode
|
|
|
10
10
|
from uuid import uuid4
|
|
11
11
|
|
|
12
12
|
from envloop.downloads import ArtifactError, artifact_path, download_file
|
|
13
|
-
from envloop.http import RemoteError
|
|
13
|
+
from envloop.http import RemoteError, validate_public_execution
|
|
14
14
|
from envloop.utils.logging import get_logger
|
|
15
15
|
|
|
16
16
|
logger = get_logger(__name__)
|
|
@@ -426,6 +426,14 @@ class Jobs:
|
|
|
426
426
|
from .http import configure_transport
|
|
427
427
|
configure_transport(self._server)
|
|
428
428
|
|
|
429
|
+
def chat(self, job_id: str, *, messages: list[dict[str, Any]], stream: bool = False,
|
|
430
|
+
timeout_seconds: float = 120, **options: Any):
|
|
431
|
+
"""Chat with this Inference Job; install envloop-cli[chat]. Close streamed iterators on early exit."""
|
|
432
|
+
from envloop_chat.client import chat
|
|
433
|
+
|
|
434
|
+
return chat(self._server, job_id, messages=messages, stream=stream,
|
|
435
|
+
timeout_seconds=timeout_seconds, **options)
|
|
436
|
+
|
|
429
437
|
def submit(self, dataset: str | Mapping[str, Any] | None = None, *, source: Any = None,
|
|
430
438
|
task_ref: Mapping[str, Any] | None = None, task_id: str | None = None,
|
|
431
439
|
request_id: str | None = None, attempts: int = 1, namespace: str | None = None,
|
|
@@ -447,6 +455,7 @@ class Jobs:
|
|
|
447
455
|
``error=BUDGET_EXCEEDED`` when it is reached and its result reports ``cost``.
|
|
448
456
|
``resources`` (``cpus``, ``memory_mb``, ``storage_mb``, ``gpus``) overrides the Runner and
|
|
449
457
|
Profile shape of each Trial for this Job.
|
|
458
|
+
Bench/Sandbox Jobs can request a ``provider`` name. The connected platform validates the selection.
|
|
450
459
|
"""
|
|
451
460
|
if type not in {'bench', 'sandbox'}:
|
|
452
461
|
raise ValueError('Jobs.submit type must be bench or sandbox; use training_jobs.submit for train')
|
|
@@ -454,13 +463,14 @@ class Jobs:
|
|
|
454
463
|
options['profile'] = dict(profile)
|
|
455
464
|
profile = None
|
|
456
465
|
if profile is not None:
|
|
466
|
+
provider = options.pop('provider', None)
|
|
457
467
|
if (any(value is not None for value in (dataset, source, task_ref, task_id, namespace, config, split,
|
|
458
468
|
revision, runner, profile_id, job_id, tag, command, source_job_id, source_trial_id, image, params))
|
|
459
469
|
or attempts != 1 or queue_id != 'default' or priority != 0 or options):
|
|
460
470
|
raise ValueError('Named Profiles accept inputs, parameters, request_id and max_cost_usd; execution is frozen by the Profile')
|
|
461
471
|
return self.submit_profile(profile, type=type, inputs=inputs, parameters=parameters, request_id=request_id,
|
|
462
472
|
budget=job_budget(max_cost_usd) if max_cost_usd is not None else None,
|
|
463
|
-
resources=resources)
|
|
473
|
+
resources=resources, provider=provider)
|
|
464
474
|
if inputs is not None or parameters is not None:
|
|
465
475
|
raise ValueError('inputs and parameters require a named profile')
|
|
466
476
|
if image is not None and type != 'sandbox':
|
|
@@ -481,7 +491,6 @@ class Jobs:
|
|
|
481
491
|
if resources is not None:
|
|
482
492
|
options['resources'] = job_resources(resources)
|
|
483
493
|
if type == 'sandbox':
|
|
484
|
-
from envloop.http import validate_public_execution
|
|
485
494
|
from envloop_experiment.sandbox import (
|
|
486
495
|
sandbox_runner_selector,
|
|
487
496
|
validate_image,
|
|
@@ -553,7 +562,10 @@ class Jobs:
|
|
|
553
562
|
return job
|
|
554
563
|
|
|
555
564
|
def submit_spec(self, body: dict[str, Any], *, params: Mapping[str, Any] | None = None):
|
|
556
|
-
"""Submit a canonical four-type JobSpec envelope or a Bench/Sandbox request in the legacy shape.
|
|
565
|
+
"""Submit a canonical four-type JobSpec envelope or a Bench/Sandbox request in the legacy shape.
|
|
566
|
+
|
|
567
|
+
Explicit Bench/Sandbox provider selection belongs at the top level of either request shape.
|
|
568
|
+
"""
|
|
557
569
|
if isinstance(body, dict) and isinstance(body.get("spec"), dict) and 'schema' in body['spec']:
|
|
558
570
|
if body['spec']['schema'] != 'envloop.job/v2':
|
|
559
571
|
raise ValueError('New submissions require envloop.job/v2; use bench for evaluation')
|
|
@@ -567,9 +579,7 @@ class Jobs:
|
|
|
567
579
|
body = deepcopy(body)
|
|
568
580
|
overrides = body.setdefault("overrides", {})
|
|
569
581
|
overrides["params"] = {**overrides.get("params", {}), **deepcopy(dict(params))}
|
|
570
|
-
|
|
571
|
-
validate_public_execution(body['spec'], allow_local_sandbox=False)
|
|
572
|
-
validate_public_execution(body.get('overrides'), allow_local_sandbox=False)
|
|
582
|
+
validate_public_execution(body)
|
|
573
583
|
request_id = body.get('request_id', str(uuid4()))
|
|
574
584
|
if not isinstance(request_id, str) or not request_id.strip() or len(request_id) > 128:
|
|
575
585
|
raise ValueError('request_id must be a non-empty string of at most 128 characters')
|
|
@@ -582,7 +592,9 @@ class Jobs:
|
|
|
582
592
|
request_id = body.get('request_id', str(uuid4()))
|
|
583
593
|
if not isinstance(request_id, str) or not request_id.strip() or len(request_id) > 128:
|
|
584
594
|
raise ValueError('request_id must be a non-empty string of at most 128 characters')
|
|
585
|
-
|
|
595
|
+
request = {'type': 'bench', 'request_id': request_id, **body}
|
|
596
|
+
validate_public_execution(request)
|
|
597
|
+
return self._server.submit_job(request)
|
|
586
598
|
|
|
587
599
|
def resolve(self, spec: Mapping[str, Any]) -> dict[str, Any]:
|
|
588
600
|
"""Resolve an ``envloop.job/v2`` envelope (``spec``, optional ``overrides``) without submitting it.
|
|
@@ -610,7 +622,8 @@ class Jobs:
|
|
|
610
622
|
|
|
611
623
|
def submit_profile(self, profile: str, *, type: str = 'bench', inputs: Mapping[str, str | Mapping[str, str]] | None = None,
|
|
612
624
|
parameters: Mapping[str, Any] | None = None, request_id: str | None = None,
|
|
613
|
-
budget: Mapping[str, Any] | None = None, resources: Mapping[str, Any] | None = None
|
|
625
|
+
budget: Mapping[str, Any] | None = None, resources: Mapping[str, Any] | None = None,
|
|
626
|
+
provider: str | None = None):
|
|
614
627
|
"""Submit only Profile intent and ANS inputs; resolution runs on the platform."""
|
|
615
628
|
from envloop_experiment.named_profile import (
|
|
616
629
|
profile_record,
|
|
@@ -618,7 +631,7 @@ class Jobs:
|
|
|
618
631
|
submission,
|
|
619
632
|
)
|
|
620
633
|
body = submission(profile, type=type, inputs=inputs, parameters=parameters,
|
|
621
|
-
request_id=request_id, budget=budget, resources=resources)
|
|
634
|
+
request_id=request_id, budget=budget, resources=resources, provider=provider)
|
|
622
635
|
return self._server.submit_job(profile_request(body, lambda name, version: profile_record(self._server, name, version)))
|
|
623
636
|
|
|
624
637
|
def regrade(self, *, job_id: str | None = None, trial_ids: Sequence[str] | None = None,
|
envloop_experiment/http.py
CHANGED
|
@@ -34,8 +34,7 @@ class Endpoints:
|
|
|
34
34
|
|
|
35
35
|
def resolve_job(self, body: dict[str, Any]):
|
|
36
36
|
"""Resolve a JobSpec without admission; the platform creates no Job and reserves no budget."""
|
|
37
|
-
validate_public_execution(body
|
|
38
|
-
validate_public_execution(body.get('overrides'), allow_local_sandbox=False)
|
|
37
|
+
validate_public_execution(body, allow_sandbox_provider=False)
|
|
39
38
|
configure_transport(self)
|
|
40
39
|
return self.request("POST", "/v1/jobs/resolve", body)
|
|
41
40
|
|
|
@@ -6,6 +6,7 @@ from copy import deepcopy
|
|
|
6
6
|
from types import SimpleNamespace
|
|
7
7
|
from typing import Any, cast
|
|
8
8
|
|
|
9
|
+
from envloop.http import validate_public_execution
|
|
9
10
|
from envloop_experiment.client import dataset_selector, runner_selector
|
|
10
11
|
from envloop_experiment.train_runner_cli import (
|
|
11
12
|
SHORTCUT_FIELDS,
|
|
@@ -78,7 +79,6 @@ def spec_request(args: argparse.Namespace):
|
|
|
78
79
|
raise ValueError('--harbor_env requires a canonical --spec with schema envloop.job/v1 or a named --profile')
|
|
79
80
|
if getattr(args, 'provider', None) is not None:
|
|
80
81
|
request['provider'] = args.provider
|
|
81
|
-
from envloop.http import validate_public_execution
|
|
82
82
|
validate_public_execution(request)
|
|
83
83
|
if args.request_id is not None:
|
|
84
84
|
request['request_id'] = args.request_id
|
|
@@ -211,7 +211,7 @@ def spec_request(args: argparse.Namespace):
|
|
|
211
211
|
|
|
212
212
|
|
|
213
213
|
def unified_request(args: argparse.Namespace, request: dict[str, Any]) -> dict[str, Any]:
|
|
214
|
-
"""
|
|
214
|
+
"""Apply CLI values to the canonical JobSpec envelope or its overrides."""
|
|
215
215
|
spec = request['spec']
|
|
216
216
|
kind = spec.get('type')
|
|
217
217
|
if kind not in ('bench', 'sandbox', 'train', 'inference') or args.type is not None and args.type != kind:
|
|
@@ -220,7 +220,7 @@ def unified_request(args: argparse.Namespace, request: dict[str, Any]) -> dict[s
|
|
|
220
220
|
if args.harbor_env is not None and kind not in {'bench', 'sandbox'}:
|
|
221
221
|
raise ValueError('--harbor_env applies only to Bench/Sandbox Jobs')
|
|
222
222
|
incompatible = ('dataset', 'dataset_option', 'source', 'task_id', 'config', 'split', 'revision',
|
|
223
|
-
'job_id', 'tag', 'attempts', 'profile', 'delete_delay_seconds',
|
|
223
|
+
'job_id', 'tag', 'attempts', 'profile', 'delete_delay_seconds', *TRAIN_ONLY_FIELDS)
|
|
224
224
|
if any(getattr(args, key, None) is not None for key in incompatible):
|
|
225
225
|
raise ValueError('Unified JobSpec uses spec.inputs and spec fields for legacy submission options')
|
|
226
226
|
if kind == 'inference' and (args.wait or any(getattr(args, key, None) is not None for key in
|
|
@@ -254,4 +254,7 @@ def unified_request(args: argparse.Namespace, request: dict[str, Any]) -> dict[s
|
|
|
254
254
|
request['overrides'] = overrides
|
|
255
255
|
if args.request_id is not None:
|
|
256
256
|
request['request_id'] = args.request_id
|
|
257
|
+
if getattr(args, 'provider', None) is not None:
|
|
258
|
+
request['provider'] = args.provider
|
|
259
|
+
validate_public_execution(request)
|
|
257
260
|
return request
|
|
@@ -107,7 +107,7 @@ def input_selectors(values: Mapping[str, str | Mapping[str, str]]) -> dict[str,
|
|
|
107
107
|
def submission(profile: str, *, type: str, inputs: Mapping[str, str | Mapping[str, str]] | None = None,
|
|
108
108
|
parameters: Mapping[str, Any] | None = None, request_id: str | None = None,
|
|
109
109
|
budget: Mapping[str, Any] | None = None,
|
|
110
|
-
resources: Mapping[str, Any] | None = None) -> dict[str, Any]:
|
|
110
|
+
resources: Mapping[str, Any] | None = None, provider: str | None = None) -> dict[str, Any]:
|
|
111
111
|
from envloop.http import validate_public_execution
|
|
112
112
|
from envloop_experiment.runtime_params import validate_params
|
|
113
113
|
|
|
@@ -123,6 +123,8 @@ def submission(profile: str, *, type: str, inputs: Mapping[str, str | Mapping[st
|
|
|
123
123
|
body: dict[str, Any] = {'type': type, 'profile_name': name, 'request_id': request_id,
|
|
124
124
|
'inputs': input_selectors(inputs or {}),
|
|
125
125
|
'parameters': dict(parameters or {})}
|
|
126
|
+
if provider is not None:
|
|
127
|
+
body['provider'] = provider
|
|
126
128
|
if separator:
|
|
127
129
|
body['profile_version'] = version
|
|
128
130
|
if budget is not None:
|
|
@@ -170,6 +172,8 @@ def profile_request(body: dict[str, Any], lookup: Callable[[str, str | None], An
|
|
|
170
172
|
profile += '@' + body['profile_version']
|
|
171
173
|
request: dict[str, Any] = {'request_id': body['request_id'],
|
|
172
174
|
'spec': {'schema': 'envloop.job/v2', 'type': body['type'], 'profile': profile}}
|
|
175
|
+
if 'provider' in body:
|
|
176
|
+
request['provider'] = body['provider']
|
|
173
177
|
overrides = {key: deepcopy(body[source]) for key, source in
|
|
174
178
|
(('params', 'parameters'), ('budget', 'budget'), ('resources', 'resources')) if body.get(source)}
|
|
175
179
|
if overrides:
|
|
File without changes
|
|
File without changes
|