sequence-ai 0.34.2__tar.gz → 0.34.4__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.
Files changed (104) hide show
  1. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/PKG-INFO +1 -1
  2. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/pyproject.toml +1 -1
  3. sequence_ai-0.34.4/seq/audit_cli.py +69 -0
  4. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/capacity_cli.py +8 -5
  5. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/cli.py +4 -0
  6. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/cli_parser.py +47 -12
  7. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/deploy_cli.py +36 -0
  8. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/ops_cli.py +15 -1
  9. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/registry.py +17 -1
  10. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/__init__.py +1 -1
  11. sequence_ai-0.34.2/seq/audit_cli.py +0 -39
  12. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/.gitignore +0 -0
  13. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/LICENSE +0 -0
  14. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/README.md +0 -0
  15. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/eval.md +0 -0
  16. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/observability.md +0 -0
  17. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/__init__.py +0 -0
  18. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/__main__.py +0 -0
  19. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_account.py +0 -0
  20. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_deploy_gateway.py +0 -0
  21. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_eval_gateway.py +0 -0
  22. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_gateway.py +0 -0
  23. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_mock.py +0 -0
  24. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_observe_gateway.py +0 -0
  25. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/_partial.py +0 -0
  26. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/adapter.py +0 -0
  27. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/adapter_check.py +0 -0
  28. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/adapter_cli.py +0 -0
  29. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/base.py +0 -0
  30. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/benchmark.py +0 -0
  31. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/benchmark_registry.py +0 -0
  32. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/benchmark_rm.py +0 -0
  33. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/cli_json.py +0 -0
  34. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/code_bundle.py +0 -0
  35. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/data_cli.py +0 -0
  36. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/deploy.py +0 -0
  37. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/deployments_cli.py +0 -0
  38. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/errors.py +0 -0
  39. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/eval.py +0 -0
  40. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/eval_cli.py +0 -0
  41. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/eval_engine.py +0 -0
  42. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/image.py +0 -0
  43. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/kinds.py +0 -0
  44. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/listing.py +0 -0
  45. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/loading.py +0 -0
  46. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/observe.py +0 -0
  47. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/params.py +0 -0
  48. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/policy.py +0 -0
  49. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/__init__.py +0 -0
  50. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/check.py +0 -0
  51. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/cli.py +0 -0
  52. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/compare.py +0 -0
  53. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/errors.py +0 -0
  54. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/export.py +0 -0
  55. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/motion.py +0 -0
  56. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/mujoco.py +0 -0
  57. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/sapien.py +0 -0
  58. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/port/scaffold.py +0 -0
  59. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/presets/__init__.py +0 -0
  60. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/presets/robot_arm.py +0 -0
  61. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/robot_cli.py +0 -0
  62. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/run_logs.py +0 -0
  63. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/safety.py +0 -0
  64. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/secret.py +0 -0
  65. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/storage_cli.py +0 -0
  66. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/template_fetch.py +0 -0
  67. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/tf.py +0 -0
  68. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/usage_hist.py +0 -0
  69. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/volume.py +0 -0
  70. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/volume_upload.py +0 -0
  71. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq/weights.py +0 -0
  72. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/seq_launch.py +0 -0
  73. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/__init__.py +0 -0
  74. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/_mock_assets/worker.cert.pem +0 -0
  75. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/_mock_assets/worker.key.pem +0 -0
  76. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/capacity.py +0 -0
  77. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/catalogue.py +0 -0
  78. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/diagnostics.py +0 -0
  79. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/direct.py +0 -0
  80. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/encode.py +0 -0
  81. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/error_codes.py +0 -0
  82. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/logsource.py +0 -0
  83. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/mock_direct.py +0 -0
  84. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/names.py +0 -0
  85. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/reporting.py +0 -0
  86. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/rid.py +0 -0
  87. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/_core/transport.py +0 -0
  88. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/__init__.py +0 -0
  89. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/frames.py +0 -0
  90. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/observation.py +0 -0
  91. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/policy.py +0 -0
  92. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/run_loop.py +0 -0
  93. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/act/types.py +0 -0
  94. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/chat/__init__.py +0 -0
  95. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/chat/content.py +0 -0
  96. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/chat/conversation.py +0 -0
  97. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/chat/infer.py +0 -0
  98. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/chat/types.py +0 -0
  99. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/decide/__init__.py +0 -0
  100. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/decide/infer.py +0 -0
  101. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/decide/types.py +0 -0
  102. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/errors.py +0 -0
  103. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/py.typed +0 -0
  104. {sequence_ai-0.34.2 → sequence_ai-0.34.4}/sequence_ai/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sequence-ai
3
- Version: 0.34.2
3
+ Version: 0.34.4
4
4
  Summary: The inference and benchmark platform for physical AI: deploy a robot policy, run it on your robot, score it.
5
5
  Project-URL: Homepage, https://generalsequences.com
6
6
  Project-URL: Documentation, https://generalsequences.com/docs/
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sequence-ai"
7
- version = "0.34.2"
7
+ version = "0.34.4"
8
8
  description = "The inference and benchmark platform for physical AI: deploy a robot policy, run it on your robot, score it."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -0,0 +1,69 @@
1
+ """
2
+ `seq audit`: your account's audit trail - who deployed, deleted, revoked or changed what, and when - newest first, a page
3
+ at a time (`GET /v1/audit`). With `seq --json`, what it read. The parser lives in seq/cli_parser.py with every other
4
+ command.
5
+
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import argparse
10
+ import json
11
+
12
+ from seq.deployments_cli import _call
13
+
14
+
15
+ def run(args: argparse.Namespace) -> int:
16
+ return _audit(args)
17
+
18
+
19
+ def _audit(args: argparse.Namespace) -> int:
20
+ path = f"/v1/audit?limit={max(1, min(int(args.limit), 200))}"
21
+ if args.before:
22
+ path += f"&before={int(args.before)}"
23
+ body = _call("GET", path, args.base_url)
24
+ events = body.get("events") or []
25
+ if args.json:
26
+ print(json.dumps(events, indent=2))
27
+ return 0
28
+ if not events:
29
+ print("Nothing has happened to this account yet.")
30
+ return 0
31
+ for e in events:
32
+ print(f"{e.get('id'):>7} {str(e.get('created_at'))[:19].replace('T', ' ')} {e.get('action'):<22} "
33
+ f"{str(e.get('target') or '—'):<28} {_who(e)}")
34
+ why = _why(e)
35
+ if why:
36
+ print(f"{'':9}{why}")
37
+ if body.get("next_before"):
38
+ print(f"\nOlder: seq audit --before {body['next_before']}")
39
+ return 0
40
+
41
+
42
+ def _who(e: dict) -> str:
43
+ """Who did it: "The platform" for a change the platform made to the account's things - a line with no person or key
44
+ behind it - else the person's email with the key they
45
+ used, the key alone, or "—" once the person or key has been deleted, as the console's Audit page shows them.
46
+
47
+ """
48
+ if e.get("actor_kind") == "platform":
49
+ return "The platform"
50
+ if e.get("actor_email"):
51
+ return f"{e['actor_email']} with {e['actor_key']}" if e.get("actor_key") else e["actor_email"]
52
+ return e.get("actor_key") or "—"
53
+
54
+
55
+ def _why(e: dict) -> str | None:
56
+ """A platform line's second line: the change, "100 → 8" (its detail's from/to, or old/new), and its reason - the
57
+ platform says why it changed the account's things, e.g. a deployment's GPU cap lowered to the account's limit. None
58
+ for every other line, which keeps to one line as before."""
59
+ if e.get("actor_kind") != "platform":
60
+ return None
61
+ d = e.get("detail") or {}
62
+ parts = []
63
+ for a, b in (("from", "to"), ("old", "new")):
64
+ if a in d and b in d:
65
+ parts.append(f"{'—' if d[a] is None else d[a]} → {'—' if d[b] is None else d[b]}")
66
+ break
67
+ if d.get("reason"):
68
+ parts.append(str(d["reason"]))
69
+ return " · ".join(parts) or None
@@ -113,7 +113,9 @@ def _clock(at: Any) -> str:
113
113
 
114
114
  def gpus(*, base_url: str | None = None, echo: Echo = _silent) -> dict:
115
115
  """The cards `gpu=` can name — memory, price per hour and per second, whether a policy and a benchmark may use it,
116
- RT cores, video encoding, render speed — and the CPU and memory prices. Public: no key needed."""
116
+ RT cores, video encoding — and the CPU and memory prices. Public: no key needed. No render column: the figure was a
117
+ fixed per-card estimate, never measured
118
+ ."""
117
119
  import sequence_ai
118
120
 
119
121
  prices = sequence_ai.gpus(base_url=base_url)
@@ -127,15 +129,14 @@ def show_gpus(prices: dict, echo: Echo) -> None:
127
129
  rows = prices.get("gpus") or []
128
130
  w = max([len("card")] + [len(str(g.get("gpu"))) for g in rows]) + 2
129
131
  echo(f"{'card':{w}}{'VRAM':>7} {'$/hour':>8} {'$/second':>11} {'policy':8}{'benchmark':15}{'RT core':9}"
130
- f"{'NVENC':7}render")
132
+ f"NVENC")
131
133
  for g in rows:
132
134
  vram = f"{g['vram_gb']} GB" if g.get("vram_gb") is not None else "—"
133
135
  per_s = f"{float(g['usd_per_second']):.8f}" if g.get("usd_per_second") is not None else "—"
134
136
  bench = _yes(g.get("benchmark")) + (" (default)" if g.get("benchmark") and g.get("gpu") == DEFAULT_BENCHMARK_GPU
135
137
  else "")
136
- render = f"{float(g['render_ms']):g} ms" if g.get("render_ms") is not None else "—"
137
138
  echo(f"{str(g.get('gpu')):{w}}{vram:>7} {_usd(g.get('usd_per_hour')).lstrip('$'):>8} {per_s:>11} "
138
- f"{_yes(g.get('policy')):8}{bench:15}{_yes(g.get('rt_core')):9}{_yes(g.get('nvenc')):7}{render}")
139
+ f"{_yes(g.get('policy')):8}{bench:15}{_yes(g.get('rt_core')):9}{_yes(g.get('nvenc'))}")
139
140
  if not rows:
140
141
  echo("(no cards are offered right now)")
141
142
  cpu = (prices.get("cpu") or {}).get("usd_per_core_hour")
@@ -340,7 +341,9 @@ def show_scaling(name: str, a: dict, echo: Echo) -> None:
340
341
  if a.get("buffer_workers"):
341
342
  parts.append(f"{a['buffer_workers']} spare while robots are connected")
342
343
  parts.append(f"max_gpus {a['max_gpus']}" if a.get("max_gpus") else "no GPU cap of its own (the account's applies)")
343
- parts.append(f"idle workers stop after {a.get('idle_timeout') or 600} s")
344
+
345
+
346
+ parts.append(f"idle workers stop after {min(3600, max(60, int(a.get('idle_timeout') or 600)))} s")
344
347
  parts.append(f"when full: robots wait in line up to {a.get('queue_timeout_s', 120)} s"
345
348
  if a.get("on_full", "queue") == "queue" else "when full: robots are refused at once")
346
349
 
@@ -467,6 +467,10 @@ def _cmd_deploy(args: argparse.Namespace) -> int:
467
467
  existing = platform_volume_names(base_url=args.base_url)
468
468
  request = _request_of(kind, cls, name=args.name, max_gpus=args.max_gpus, require_cap=True,
469
469
  existing_volumes=existing)
470
+ if kind == "policy" and not (args.dry_run and args.json):
471
+ from seq import deploy_cli
472
+
473
+ deploy_cli.hold_cap_to_account(request, args.base_url)
470
474
  if args.dry_run:
471
475
  if args.json:
472
476
  print(request.model_dump_json(indent=2))
@@ -134,7 +134,7 @@ def build_parser() -> argparse.ArgumentParser:
134
134
  "uploads; send nothing")
135
135
  p.add_argument("--max-gpus", type=_gpu_count_arg, default=None, metavar="N",
136
136
  help="the most GPUs (cards, not workers) the deployment may hold at once, over the decorator's "
137
- "max_gpus=; a GPU policy must name one")
137
+ "max_gpus=; a GPU policy must name one, at most your account's limit (`seq account`)")
138
138
  p.add_argument("--no-wait", dest="wait", action="store_false", default=True,
139
139
  help="return once the build has started (follow it with `seq policy status <name> --wait`)")
140
140
  p.add_argument("--timeout", type=float, default=None, help="seconds to wait for the build")
@@ -263,17 +263,18 @@ def build_parser() -> argparse.ArgumentParser:
263
263
  p.add_argument("new", help="the new name")
264
264
  p = psub.add_parser("scale", help="a deployment's limits and warm workers, changed at once without a redeploy")
265
265
  p.add_argument("name", help="deployment name")
266
- p.add_argument("--min", dest="min_workers", type=int, default=None,
267
- help="warm workers kept running, robot or not (billed); with --during, only in those hours")
268
- p.add_argument("--buffer", type=int, default=None, metavar="N",
269
- help="spare running workers kept while robots are connected, so the next one skips a cold start")
266
+ p.add_argument("--min", dest="min_workers", type=_warm_count_arg, default=None,
267
+ help="warm workers kept running, robot or not (billed), 0-16; with --during, 1-16 in those hours")
268
+ p.add_argument("--buffer", type=_warm_count_arg, default=None, metavar="N",
269
+ help="spare running workers kept while robots are connected, so the next one skips a cold start "
270
+ "(0-16)")
270
271
  p.add_argument("--max-gpus", type=_gpu_count_arg, default=None, metavar="N",
271
- help="the most GPUs (cards, not workers) this deployment may hold at once; a GPU deployment always "
272
- "has one")
273
- p.add_argument("--idle-timeout", type=int, default=None, metavar="SECONDS",
274
- help="how long an idle worker keeps running before it stops (default 600)")
272
+ help="the most GPUs (cards, not workers) this deployment may hold at once, at most your account's "
273
+ "limit (`seq account`); a GPU deployment always has one")
274
+ p.add_argument("--idle-timeout", type=_idle_seconds_arg, default=None, metavar="SECONDS",
275
+ help="how long an idle worker keeps running, and is billed, before it stops (60-3600, default 600)")
275
276
 
276
- p.add_argument("--scaledown", type=int, default=None, help=argparse.SUPPRESS)
277
+ p.add_argument("--scaledown", type=_idle_seconds_arg, default=None, help=argparse.SUPPRESS)
277
278
  p.add_argument("--on-full", choices=("queue", "reject"), default=None,
278
279
  help="when every slot is taken and no GPU is left: a new robot waits in line (queue), or is "
279
280
  "refused at once (reject)")
@@ -467,12 +468,46 @@ def build_parser() -> argparse.ArgumentParser:
467
468
  return ap
468
469
 
469
470
 
471
+ def _warm_count_arg(text: str) -> int:
472
+ """`--min N` / `--buffer N`: a number of workers, 0 to 16 - what the platform holds both to
473
+ - said where it is typed rather than after a round trip
474
+
475
+ ."""
476
+ try:
477
+ n = int(text)
478
+ except ValueError:
479
+ raise argparse.ArgumentTypeError(f"{text!r} is not a number of workers") from None
480
+ if not 0 <= n <= 16:
481
+ raise argparse.ArgumentTypeError(f"a number of workers is 0 to 16; got {n}")
482
+ return n
483
+
484
+
485
+ def _idle_seconds_arg(text: str) -> int:
486
+ """`--idle-timeout SECONDS`: how long an idle worker keeps running - and is billed - before it stops, 60 to 3600,
487
+ the platform's bounds. Before, any number went out: a unit slip
488
+ (600000, milliseconds) was refused by the platform only after the round trip, and at deploy not at all
489
+ ."""
490
+ try:
491
+ n = int(text)
492
+ except ValueError:
493
+ raise argparse.ArgumentTypeError(f"{text!r} is not a number of seconds") from None
494
+ if not 60 <= n <= 3600:
495
+ raise argparse.ArgumentTypeError(f"--idle-timeout is 60 to 3600 seconds (a minute to an hour); got {n}")
496
+ return n
497
+
498
+
470
499
  def _gpu_count_arg(text: str) -> int:
471
- """`--max-gpus N`: a whole number of GPUs, 1 to 256. A GPU deployment's own cap can be changed, never removed."""
500
+ """`--max-gpus N`: a whole number of GPUs, at least 1. Its real ceiling is the account's limit, which the platform
501
+ holds it to and names when it refuses more: the CLI cannot know
502
+ it offline, so the local check keeps only the contract's own bounds (1 to 256, sequence-base Autoscaler.max_gpus) and
503
+ says the real rule. Before, it said "1 to 256 GPUs", and a Starter account set 100
504
+
505
+ . A GPU deployment's own cap can be changed, never removed."""
472
506
  try:
473
507
  n = int(text)
474
508
  except ValueError:
475
509
  raise argparse.ArgumentTypeError(f"{text!r} is not a number of GPUs") from None
476
510
  if not 1 <= n <= 256:
477
- raise argparse.ArgumentTypeError(f"--max-gpus is 1 to 256 GPUs; got {n}")
511
+ raise argparse.ArgumentTypeError(f"--max-gpus is a whole number of GPUs from 1 up to your account's limit "
512
+ f"(`seq account` shows it); got {n}")
478
513
  return n
@@ -74,6 +74,42 @@ def _require_gpu_cap(request: Any) -> None:
74
74
  raise InvalidRequest(max_gpus_required_message())
75
75
 
76
76
 
77
+ def account_gpu_limit(base_url: str | None) -> int | None:
78
+ """The GPUs this account may hold at once: GET /v1/account's gpus.limit, the platform's own figure (its contracted
79
+ limit, else its plan's - Starter 8, Team 32), or None when it cannot be read (offline, no key, a platform from before
80
+ the field): the platform holds a cap to it anyway, at deploy and on a change."""
81
+ from seq.deployments_cli import _call
82
+
83
+ try:
84
+ acct = _call("GET", "/v1/account", base_url) or {}
85
+ except SequencesError:
86
+ return None
87
+ limit = (acct.get("gpus") or {}).get("limit") if isinstance(acct, dict) else None
88
+ return int(limit) if isinstance(limit, (int, float)) and not isinstance(limit, bool) and limit >= 1 else None
89
+
90
+
91
+ def over_limit_message(max_gpus: int, limit: int) -> str:
92
+ """A cap past the account's limit, said as the platform says it."""
93
+ return (f"max_gpus={max_gpus} is more GPUs than this account may hold at once: its limit is {limit}, counted in "
94
+ f"cards. Set max_gpus to {limit} or less (`seq policy scale <name> --max-gpus {limit}`, or the GPU cap in "
95
+ "the console); the plans with a higher limit are on the console's Billing page")
96
+
97
+
98
+ def hold_cap_to_account(request: Any, base_url: str | None) -> None:
99
+ """A GPU policy's own cap past the account's limit, refused here - before code is uploaded or a build started - with
100
+ the platform's words. The CLI took any cap from 1 to 256 and a Starter account (limit 8) deployed with 100
101
+ ; the platform refuses it since, and this says so first
102
+
103
+ . A CPU policy's cap counts no GPU, as the platform reads it."""
104
+ gpus = [str(g) for g in (request.resources.gpu or [])]
105
+ cap = request.autoscaler.max_gpus if request.autoscaler else None
106
+ if cap is None or not any(g.lower() != "cpu" for g in gpus):
107
+ return
108
+ limit = account_gpu_limit(base_url)
109
+ if limit is not None and cap > limit:
110
+ raise InvalidRequest(over_limit_message(cap, limit))
111
+
112
+
77
113
  def _contract_check(request: Any) -> None:
78
114
  """Re-validate the assembled request against its own contract type — this SDK's copy of the schema the platform
79
115
  enforces, where every sub-shape forbids unknown fields and pins its types — here with no network and no build. A
@@ -85,6 +85,20 @@ def scale(name: str, *, min_workers: int | None = None, during: str | None = Non
85
85
  the settings.
86
86
  """
87
87
  from seq.capacity_cli import scaling
88
+ from seq.deploy_cli import account_gpu_limit, over_limit_message
89
+ from sequence_ai.errors import InvalidRequest
90
+
91
+
92
+
93
+
94
+ if during is not None and min_workers is None:
95
+ raise InvalidRequest("--during keeps workers warm in those hours: say how many with --min N (1 to 16)")
96
+ if during is not None and min_workers < 1:
97
+ raise InvalidRequest("--min 0 --during would keep no worker warm in those hours: to remove the warm schedule, "
98
+ "use --clear")
99
+
100
+ if max_gpus is not None and (limit := account_gpu_limit(base_url)) is not None and max_gpus > limit:
101
+ raise InvalidRequest(over_limit_message(max_gpus, limit))
88
102
 
89
103
  knobs = {k: v for k, v in (("min_workers", None if during else min_workers), ("buffer_workers", buffer),
90
104
  ("max_gpus", max_gpus), ("idle_timeout", idle_timeout), ("on_full", on_full),
@@ -94,7 +108,7 @@ def scale(name: str, *, min_workers: int | None = None, during: str | None = Non
94
108
  out = _call("DELETE", f"/v1/deployments/{segment(name)}/schedule", base_url)
95
109
  elif during:
96
110
  out = _call("PUT", f"/v1/deployments/{segment(name)}/schedule", base_url,
97
- {"min": int(min_workers or 1), "during": during, "tz": tz})
111
+ {"min": int(min_workers), "during": during, "tz": tz})
98
112
  echo(f"{name}: warm schedule set — billed for the warm workers in those hours, robot or not")
99
113
  elif limits is not None:
100
114
  return limits
@@ -393,9 +393,12 @@ def _check_scaling(kw: dict[str, Any]) -> None:
393
393
  """max_gpus= / on_full= / queue_timeout_s=, refused where they are written with what each means.
394
394
  """
395
395
  v = kw.get("max_gpus")
396
+
397
+
396
398
  if v is not None and (isinstance(v, bool) or not isinstance(v, int) or not 1 <= v <= 256):
397
399
  raise PolicyDefinitionError(f"max_gpus= is the most GPUs this deployment may hold at once (counted in cards), "
398
- f"a whole number from 1 to 256 — or leave it out for no cap of its own; got {v!r}")
400
+ f"a whole number from 1 up to your account's limit (`seq account` shows it) — or "
401
+ f"leave it out for no cap of its own; got {v!r}")
399
402
  if "on_full" in kw and kw["on_full"] not in ("queue", "reject"):
400
403
  raise PolicyDefinitionError(f"on_full= is \"queue\" (a robot that finds every slot taken waits in line, before "
401
404
  f"its control loop starts) or \"reject\" (it is refused at once); got "
@@ -407,6 +410,19 @@ def _check_scaling(kw: dict[str, Any]) -> None:
407
410
  f"from 5 to 3600; got {v!r}")
408
411
 
409
412
 
413
+ for knob, what in (("min_workers", "warm workers kept running, robot or not"),
414
+ ("buffer_workers", "spare workers kept running while robots are connected")):
415
+ if knob in kw:
416
+ v = kw[knob]
417
+ if isinstance(v, bool) or not isinstance(v, int) or not 0 <= v <= 16:
418
+ raise PolicyDefinitionError(f"{knob}= is the {what}, a whole number from 0 to 16; got {v!r}")
419
+ if "idle_timeout" in kw:
420
+ v = kw["idle_timeout"]
421
+ if isinstance(v, bool) or not isinstance(v, int) or not 60 <= v <= 3600:
422
+ raise PolicyDefinitionError(f"idle_timeout= is how long an idle worker keeps running, and is billed, before "
423
+ f"it stops: whole seconds from 60 to 3600; got {v!r}")
424
+
425
+
410
426
  def _check_card_split(gpu: Any, concurrency: Any) -> None:
411
427
  """gpus_per_replica must divide every worker's cards (`gpu="TYPE:N"`, each fallback too): a worker splits its cards
412
428
  into groups of that size, one model copy per group."""
@@ -395,7 +395,7 @@ def gpus(*, base_url: str | None = None) -> dict[str, Any]:
395
395
  cost — what `seq gpus` prints, from the platform's one price list (the pricing page reads the same).
396
396
 
397
397
  Returns `{"gpus": [{"gpu", "usd_per_hour", "usd_per_second", "vram_gb", "policy", "benchmark",
398
- "rt_core", "nvenc", "render_ms"}], "cpu": {"usd_per_core_hour"}, "memory": {"usd_per_gib_hour"},
398
+ "rt_core", "nvenc"}], "cpu": {"usd_per_core_hour"}, "memory": {"usd_per_gib_hour"},
399
399
  "compute_billed", "min_billable_s", "regions"}`. `gpu` is the name `gpu=` takes; `benchmark` says
400
400
  whether a benchmark's sims may run on it; `compute_billed` whether CPU and memory are billed yet.
401
401
  No key needed: the prices are public.
@@ -1,39 +0,0 @@
1
- """
2
- `seq audit`: your account's audit trail - who deployed, deleted, revoked or changed what, and when - newest first, a page
3
- at a time (`GET /v1/audit`). With `seq --json`, what it read. The parser lives in seq/cli_parser.py with every other
4
- command.
5
-
6
- """
7
- from __future__ import annotations
8
-
9
- import argparse
10
- import json
11
-
12
- from seq.deployments_cli import _call
13
-
14
-
15
- def run(args: argparse.Namespace) -> int:
16
- return _audit(args)
17
-
18
-
19
- def _audit(args: argparse.Namespace) -> int:
20
- path = f"/v1/audit?limit={max(1, min(int(args.limit), 200))}"
21
- if args.before:
22
- path += f"&before={int(args.before)}"
23
- body = _call("GET", path, args.base_url)
24
- events = body.get("events") or []
25
- if args.json:
26
- print(json.dumps(events, indent=2))
27
- return 0
28
- if not events:
29
- print("Nothing has happened to this account yet.")
30
- return 0
31
- for e in events:
32
- who = e.get("actor_email") or "—"
33
- if e.get("actor_key"):
34
- who = f"{who} with {e['actor_key']}"
35
- print(f"{e.get('id'):>7} {str(e.get('created_at'))[:19].replace('T', ' ')} {e.get('action'):<22} "
36
- f"{str(e.get('target') or '—'):<28} {who}")
37
- if body.get("next_before"):
38
- print(f"\nOlder: seq audit --before {body['next_before']}")
39
- return 0
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