simulo-interfaces 0.20.2__tar.gz → 0.21.0__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.
- {simulo_interfaces-0.20.2/src/simulo_interfaces.egg-info → simulo_interfaces-0.21.0}/PKG-INFO +2 -2
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/PYPI.md +1 -1
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/pyproject.toml +1 -1
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/__init__.py +14 -8
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/asset.py +1 -1
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/primitives.py +0 -2
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/scene.py +1 -2
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/terrain.py +2 -3
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/world.py +4 -8
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/ids.py +40 -20
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/__init__.py +100 -25
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/app.py +51 -9
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/asset_catalog.py +10 -14
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/callbacks.py +2 -2
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/domain.py +3 -18
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/enums.py +25 -24
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/manifest.py +33 -23
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/outputs.py +44 -119
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/policy_bundle.py +25 -27
- simulo_interfaces-0.21.0/src/simulo/interfaces/platform/preview.py +85 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/runs.py +53 -10
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/submit.py +208 -222
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/systems.py +5 -3
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/__init__.py +1 -3
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/components.py +3 -3
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/task.py +6 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0/src/simulo_interfaces.egg-info}/PKG-INFO +2 -2
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo_interfaces.egg-info/SOURCES.txt +1 -1
- simulo_interfaces-0.20.2/src/simulo/interfaces/runtime/scenario.py +0 -44
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/MANIFEST.in +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/setup.cfg +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/__init__.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/actuator.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/entity.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/light.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/materials.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/physics.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/pose.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/prop.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/record.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/robot.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/sensor.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/visual.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/exceptions.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/_payload.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/asset.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/debug.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/job_events.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/runtime.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/volume.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/py.typed +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/anomaly.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/env.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/player.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/policy.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/tensors.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/runtime/trainer.py +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo_interfaces.egg-info/dependency_links.txt +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo_interfaces.egg-info/requires.txt +0 -0
- {simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo_interfaces.egg-info/top_level.txt +0 -0
{simulo_interfaces-0.20.2/src/simulo_interfaces.egg-info → simulo_interfaces-0.21.0}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simulo-interfaces
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.0
|
|
4
4
|
Summary: Typed Python contracts for the Simulo cloud robotics SDK and managed simulation runtime.
|
|
5
5
|
Author-email: Simulo Team <team@simulo.ai>
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -47,7 +47,7 @@ Requires-Dist: twine>=5.1; extra == "release"
|
|
|
47
47
|
shared by the [Simulo SDK](https://pypi.org/project/simulo/) and its managed
|
|
48
48
|
cloud robotics simulation runtime. It defines protocols, enums, identifiers,
|
|
49
49
|
and dataclasses for robot-learning tasks, environments, policies, trainers,
|
|
50
|
-
applications, jobs, assets, checkpoints, and
|
|
50
|
+
applications, jobs, assets, policies, checkpoints, and policy exports.
|
|
51
51
|
|
|
52
52
|
## Install Simulo
|
|
53
53
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
shared by the [Simulo SDK](https://pypi.org/project/simulo/) and its managed
|
|
5
5
|
cloud robotics simulation runtime. It defines protocols, enums, identifiers,
|
|
6
6
|
and dataclasses for robot-learning tasks, environments, policies, trainers,
|
|
7
|
-
applications, jobs, assets, checkpoints, and
|
|
7
|
+
applications, jobs, assets, policies, checkpoints, and policy exports.
|
|
8
8
|
|
|
9
9
|
## Install Simulo
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "simulo-interfaces"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.21.0"
|
|
8
8
|
description = "Typed Python contracts for the Simulo cloud robotics SDK and managed simulation runtime."
|
|
9
9
|
readme = "PYPI.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -5,11 +5,11 @@ torch / numpy / gymnasium / Isaac / AWS / HTTP / DB installed. Two parts:
|
|
|
5
5
|
|
|
6
6
|
* **Part A — ``simulo.interfaces.runtime``**: tensor-library-agnostic structural
|
|
7
7
|
Protocols mirroring the ``simulo.core`` runtime surface (Task, Policy,
|
|
8
|
-
Trainer, Player, LearningEnv,
|
|
8
|
+
Trainer, Player, LearningEnv, and the observation/reward/termination
|
|
9
9
|
components).
|
|
10
10
|
* **Part B — ``simulo.interfaces.platform``**: platform/workspace domain
|
|
11
11
|
contracts — wire-stable enums, frozen domain dataclasses (Project, Package,
|
|
12
|
-
Job, Resource, Checkpoint,
|
|
12
|
+
Job, Resource, Checkpoint, Tag), and the cloud-execution
|
|
13
13
|
Protocols (App, Runtime, Asset, Volume, callbacks, and
|
|
14
14
|
debug/replay/visualization sessions).
|
|
15
15
|
|
|
@@ -29,29 +29,33 @@ from simulo.interfaces.exceptions import (
|
|
|
29
29
|
)
|
|
30
30
|
from simulo.interfaces.ids import (
|
|
31
31
|
CheckpointId,
|
|
32
|
+
CheckpointRefIsJobError,
|
|
32
33
|
Digest,
|
|
33
34
|
JobId,
|
|
34
35
|
JobPublicId,
|
|
35
|
-
ModelPublicId,
|
|
36
36
|
OrganizationId,
|
|
37
37
|
OutputPublicId,
|
|
38
38
|
PackageId,
|
|
39
|
+
PolicyPublicId,
|
|
39
40
|
ProjectId,
|
|
40
41
|
RecordingPublicId,
|
|
41
42
|
ResourceId,
|
|
42
43
|
ResourceUri,
|
|
43
44
|
TagId,
|
|
44
|
-
|
|
45
|
+
checkpoint_ref_is_job_hint,
|
|
46
|
+
parse_checkpoint_ref,
|
|
45
47
|
parse_job_public_id,
|
|
46
|
-
parse_model_public_id,
|
|
47
48
|
parse_output_public_id,
|
|
48
49
|
parse_recording_public_id,
|
|
50
|
+
policy_id_for_job,
|
|
49
51
|
)
|
|
52
|
+
from simulo.interfaces.platform.enums import JobType
|
|
50
53
|
|
|
51
54
|
__all__ = [
|
|
52
55
|
# subpackages
|
|
53
56
|
"platform",
|
|
54
57
|
"runtime",
|
|
58
|
+
"JobType",
|
|
55
59
|
# exception hierarchy
|
|
56
60
|
"SimuloError",
|
|
57
61
|
"ContractViolationError",
|
|
@@ -65,16 +69,18 @@ __all__ = [
|
|
|
65
69
|
"PackageId",
|
|
66
70
|
"JobId",
|
|
67
71
|
"JobPublicId",
|
|
68
|
-
"
|
|
72
|
+
"PolicyPublicId",
|
|
69
73
|
"RecordingPublicId",
|
|
70
74
|
"OutputPublicId",
|
|
71
75
|
"parse_job_public_id",
|
|
72
|
-
"
|
|
76
|
+
"parse_checkpoint_ref",
|
|
77
|
+
"policy_id_for_job",
|
|
78
|
+
"checkpoint_ref_is_job_hint",
|
|
79
|
+
"CheckpointRefIsJobError",
|
|
73
80
|
"parse_recording_public_id",
|
|
74
81
|
"parse_output_public_id",
|
|
75
82
|
"ResourceId",
|
|
76
83
|
"CheckpointId",
|
|
77
|
-
"TrainedModelId",
|
|
78
84
|
"TagId",
|
|
79
85
|
"ResourceUri",
|
|
80
86
|
"Digest",
|
{simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/asset.py
RENAMED
|
@@ -40,7 +40,7 @@ class USDAsset(AssetSource):
|
|
|
40
40
|
"""USD file asset.
|
|
41
41
|
|
|
42
42
|
Attributes:
|
|
43
|
-
path: Path to
|
|
43
|
+
path: Path to a local or supported remote USD file. The
|
|
44
44
|
legacy simulo:// path alias is REMOVED — 'simulo/...' is a catalog
|
|
45
45
|
ref ([publisher/]kind/name[:vN], 'simulo' = the global-catalog
|
|
46
46
|
publisher), resolved through
|
{simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/scene.py
RENAMED
|
@@ -5,8 +5,7 @@ the ``Scene`` implementation itself stays in the backend package — it is the
|
|
|
5
5
|
backend adapter (it writes backend-private state and drives engine-private
|
|
6
6
|
methods when the simulation flushes), so its *implementation* cannot live in a
|
|
7
7
|
zero-dependency package. What CAN live here is its declared public surface:
|
|
8
|
-
these Protocols name exactly what
|
|
9
|
-
a task or scenario — may rely on.
|
|
8
|
+
these Protocols name exactly what a task's ``build(scene)`` method may rely on.
|
|
10
9
|
|
|
11
10
|
The backend's concrete ``Scene`` / ``SceneGroup`` classes explicitly inherit
|
|
12
11
|
these Protocols (nominal conformance, the same pattern the ``runtime``
|
{simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/terrain.py
RENAMED
|
@@ -87,7 +87,7 @@ class RoughTerrain(TerrainConfig):
|
|
|
87
87
|
|
|
88
88
|
This terrain type generates a grid of sub-terrains with various
|
|
89
89
|
difficulty levels, suitable for curriculum learning in locomotion
|
|
90
|
-
tasks.
|
|
90
|
+
tasks.
|
|
91
91
|
|
|
92
92
|
Attributes:
|
|
93
93
|
num_rows: Number of terrain rows (sub-terrain grid rows)
|
|
@@ -104,7 +104,7 @@ class RoughTerrain(TerrainConfig):
|
|
|
104
104
|
```python
|
|
105
105
|
import simulo
|
|
106
106
|
|
|
107
|
-
# Create rough terrain
|
|
107
|
+
# Create a rough terrain configuration
|
|
108
108
|
terrain = simulo.Terrain.rough(
|
|
109
109
|
name="terrain",
|
|
110
110
|
num_rows=10,
|
|
@@ -254,7 +254,6 @@ class Terrain:
|
|
|
254
254
|
|
|
255
255
|
This creates a grid of sub-terrains with varying difficulty,
|
|
256
256
|
suitable for curriculum learning in locomotion tasks.
|
|
257
|
-
Equivalent to IsaacLab's TerrainGeneratorCfg with TerrainImporterCfg.
|
|
258
257
|
|
|
259
258
|
Args:
|
|
260
259
|
name: Terrain name
|
{simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/authoring/world.py
RENAMED
|
@@ -28,9 +28,7 @@ class USDWorld:
|
|
|
28
28
|
Attributes:
|
|
29
29
|
name: World name
|
|
30
30
|
pose: Pose in space (usually identity for USD scenes)
|
|
31
|
-
path: Path to USD file.
|
|
32
|
-
- Local paths: "/path/to/scene.usd"
|
|
33
|
-
- Nucleus paths: "nucleus://Isaac/Environments/..."
|
|
31
|
+
path: Path to a local or supported remote USD file.
|
|
34
32
|
A catalog world (USD Asset Catalogs) is referenced via
|
|
35
33
|
simulo.Asset.from_registry("simulo/world/<name>:v1") and mounted
|
|
36
34
|
like any other asset — a "simulo://" path scheme is not
|
|
@@ -43,7 +41,7 @@ class USDWorld:
|
|
|
43
41
|
# Load warehouse for inference
|
|
44
42
|
warehouse = simulo.World.usd(
|
|
45
43
|
name="warehouse",
|
|
46
|
-
path="
|
|
44
|
+
path="/path/to/warehouse.usd",
|
|
47
45
|
)
|
|
48
46
|
scene.add(warehouse, at="/World", per_environment=False)
|
|
49
47
|
```
|
|
@@ -80,9 +78,7 @@ class World:
|
|
|
80
78
|
|
|
81
79
|
Args:
|
|
82
80
|
name: World name
|
|
83
|
-
path: Path to USD file.
|
|
84
|
-
- Local paths: "/path/to/scene.usd"
|
|
85
|
-
- Nucleus paths: "nucleus://Isaac/Environments/..."
|
|
81
|
+
path: Path to a local or supported remote USD file.
|
|
86
82
|
pose: Pose in space (usually identity for USD scenes)
|
|
87
83
|
spawn_origin: Position (x, y, z) where robot should spawn
|
|
88
84
|
|
|
@@ -94,7 +90,7 @@ class World:
|
|
|
94
90
|
# Inference in warehouse
|
|
95
91
|
warehouse = simulo.World.usd(
|
|
96
92
|
name="warehouse",
|
|
97
|
-
path="
|
|
93
|
+
path="/path/to/warehouse.usd",
|
|
98
94
|
spawn_origin=(0, 0, 0),
|
|
99
95
|
)
|
|
100
96
|
scene.add(warehouse, at="/World", per_environment=False)
|
|
@@ -31,7 +31,7 @@ AssetVersionId = NewType("AssetVersionId", str) # one immutable asset version (
|
|
|
31
31
|
OutputId = NewType("OutputId", str) # a job-produced output in the /outputs projection (Plan B)
|
|
32
32
|
|
|
33
33
|
JobPublicId = NewType("JobPublicId", str)
|
|
34
|
-
|
|
34
|
+
PolicyPublicId = NewType("PolicyPublicId", str)
|
|
35
35
|
RecordingPublicId = NewType("RecordingPublicId", str)
|
|
36
36
|
OutputPublicId = NewType("OutputPublicId", str)
|
|
37
37
|
|
|
@@ -43,9 +43,10 @@ _ASCII_LOWERCASE_TRANSLATION = str.maketrans(
|
|
|
43
43
|
_JOB_STEM_PATTERN = r"[a-z]{3,10}-[a-z]{3,10}-[0-9a-hjkmnp-tv-z]{6}"
|
|
44
44
|
_CANONICAL_CHILD_COUNTER_PATTERN = r"(?:(?!0000)[0-9]{4}|[1-9][0-9]{4,})"
|
|
45
45
|
_JOB_PUBLIC_ID_RE = re.compile(rf"job_{_JOB_STEM_PATTERN}\Z")
|
|
46
|
-
_MODEL_PUBLIC_ID_RE = re.compile(rf"mdl_{_JOB_STEM_PATTERN}-{_CANONICAL_CHILD_COUNTER_PATTERN}\Z")
|
|
47
46
|
_RECORDING_PUBLIC_ID_RE = re.compile(rf"rec_{_JOB_STEM_PATTERN}-{_CANONICAL_CHILD_COUNTER_PATTERN}\Z")
|
|
48
47
|
_OUTPUT_PUBLIC_ID_RE = re.compile(rf"out_{_JOB_STEM_PATTERN}-{_CANONICAL_CHILD_COUNTER_PATTERN}\Z")
|
|
48
|
+
_POLICY_CHECKPOINT_REF_RE = re.compile(rf"policy_({_JOB_STEM_PATTERN}):(best|latest)\Z")
|
|
49
|
+
_JOB_CHECKPOINT_REF_RE = re.compile(rf"job_({_JOB_STEM_PATTERN}):(best|latest)\Z")
|
|
49
50
|
_MAX_JOB_PUBLIC_ID_LENGTH = 32
|
|
50
51
|
_MAX_CHILD_PUBLIC_ID_LENGTH = 64
|
|
51
52
|
|
|
@@ -81,24 +82,6 @@ def parse_job_public_id(value: str) -> JobPublicId:
|
|
|
81
82
|
)
|
|
82
83
|
|
|
83
84
|
|
|
84
|
-
def parse_model_public_id(value: str) -> ModelPublicId:
|
|
85
|
-
"""Return a canonical Model ID such as ``mdl_quiet-cedar-7k3m4q-0001``.
|
|
86
|
-
|
|
87
|
-
Only outer ASCII whitespace is trimmed and only ASCII ``A-Z`` is
|
|
88
|
-
lowercased. Matching is exact and non-ASCII input is rejected. Counters
|
|
89
|
-
use exactly four digits through ``9999`` and expand unpadded at ``10000``.
|
|
90
|
-
"""
|
|
91
|
-
|
|
92
|
-
return ModelPublicId(
|
|
93
|
-
_parse_public_id(
|
|
94
|
-
value,
|
|
95
|
-
parser="parse_model_public_id",
|
|
96
|
-
pattern=_MODEL_PUBLIC_ID_RE,
|
|
97
|
-
max_length=_MAX_CHILD_PUBLIC_ID_LENGTH,
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
|
|
102
85
|
def parse_recording_public_id(value: str) -> RecordingPublicId:
|
|
103
86
|
"""Return a Recording ID such as ``rec_quiet-cedar-7k3m4q-0001``.
|
|
104
87
|
|
|
@@ -133,3 +116,40 @@ def parse_output_public_id(value: str) -> OutputPublicId:
|
|
|
133
116
|
max_length=_MAX_CHILD_PUBLIC_ID_LENGTH,
|
|
134
117
|
)
|
|
135
118
|
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class CheckpointRefIsJobError(ValueError):
|
|
122
|
+
"""A checkpoint reference used a job ID where a policy ID is required."""
|
|
123
|
+
|
|
124
|
+
def __init__(self, stem: str, kind: str) -> None:
|
|
125
|
+
self.stem = stem
|
|
126
|
+
self.kind = kind
|
|
127
|
+
super().__init__(checkpoint_ref_is_job_hint(stem, kind))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def checkpoint_ref_is_job_hint(stem: str, kind: str) -> str:
|
|
131
|
+
"""Format Rule 10's actionable job-reference correction."""
|
|
132
|
+
|
|
133
|
+
return f"job_{stem} is a job; did you mean policy_{stem}:{kind}?"
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def policy_id_for_job(value: str) -> PolicyPublicId:
|
|
137
|
+
"""Return the policy ID for one canonical public job ID."""
|
|
138
|
+
|
|
139
|
+
job_id = parse_job_public_id(value)
|
|
140
|
+
return PolicyPublicId(f"policy_{str(job_id).removeprefix('job_')}")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def parse_checkpoint_ref(value: str) -> tuple[PolicyPublicId, str]:
|
|
144
|
+
"""Parse a normalized ``policy_<stem>:best|latest`` checkpoint reference."""
|
|
145
|
+
|
|
146
|
+
normalized = _normalize_public_id(value, parser="parse_checkpoint_ref")
|
|
147
|
+
match = _POLICY_CHECKPOINT_REF_RE.fullmatch(normalized)
|
|
148
|
+
if match is not None:
|
|
149
|
+
stem, kind = match.groups()
|
|
150
|
+
return PolicyPublicId(f"policy_{stem}"), kind
|
|
151
|
+
job_match = _JOB_CHECKPOINT_REF_RE.fullmatch(normalized)
|
|
152
|
+
if job_match is not None:
|
|
153
|
+
stem, kind = job_match.groups()
|
|
154
|
+
raise CheckpointRefIsJobError(stem, kind)
|
|
155
|
+
raise ValueError("parse_checkpoint_ref() requires policy_<stem>:best or policy_<stem>:latest.")
|
{simulo_interfaces-0.20.2 → simulo_interfaces-0.21.0}/src/simulo/interfaces/platform/__init__.py
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Part B — platform/workspace domain contracts.
|
|
2
2
|
|
|
3
3
|
Wire-stable enums, frozen domain dataclasses (Project, Package, Job, Resource,
|
|
4
|
-
Checkpoint,
|
|
4
|
+
Checkpoint, Tag), and the cloud-execution Protocols (App, Runtime,
|
|
5
5
|
Asset, Volume, job callbacks, and debug/replay/visualization sessions). All
|
|
6
6
|
implementation-free — concrete behaviour lives in the future
|
|
7
7
|
``simulo`` client and the ``simulo-backend`` SDK.
|
|
@@ -69,8 +69,14 @@ from simulo.interfaces.platform.asset_catalog import (
|
|
|
69
69
|
)
|
|
70
70
|
from simulo.interfaces.platform.callbacks import JobCallbackProtocol
|
|
71
71
|
from simulo.interfaces.platform.debug import DebugSessionProtocol, ReplaySessionProtocol, VisualizationSessionProtocol
|
|
72
|
-
from simulo.interfaces.platform.domain import Checkpoint, Job, Package, Project, Resource, Tag
|
|
73
|
-
from simulo.interfaces.platform.enums import
|
|
72
|
+
from simulo.interfaces.platform.domain import Checkpoint, Job, Package, Project, Resource, Tag
|
|
73
|
+
from simulo.interfaces.platform.enums import (
|
|
74
|
+
UNAVAILABLE_JOB_TYPES,
|
|
75
|
+
USER_SUBMITTABLE_JOB_TYPES,
|
|
76
|
+
JobType,
|
|
77
|
+
OutputKind,
|
|
78
|
+
SystemType,
|
|
79
|
+
)
|
|
74
80
|
from simulo.interfaces.platform.job_events import (
|
|
75
81
|
MAX_PUBLIC_ASSET_FINDING_COUNT,
|
|
76
82
|
MAX_PUBLIC_JOB_EVENT_ATTEMPT,
|
|
@@ -133,6 +139,7 @@ from simulo.interfaces.platform.outputs import (
|
|
|
133
139
|
OutputRecord,
|
|
134
140
|
)
|
|
135
141
|
from simulo.interfaces.platform.policy_bundle import (
|
|
142
|
+
EXPORT_JOB_TYPE,
|
|
136
143
|
EXPORT_VALIDATION_JOB_TYPE,
|
|
137
144
|
JOB_EXPORTS_ROUTE_TEMPLATE,
|
|
138
145
|
MAX_POLICY_BUNDLE_UNCOMPRESSED_BYTES,
|
|
@@ -186,6 +193,19 @@ from simulo.interfaces.platform.policy_bundle import (
|
|
|
186
193
|
policy_name_token,
|
|
187
194
|
validate_policy_bundle,
|
|
188
195
|
)
|
|
196
|
+
from simulo.interfaces.platform.preview import (
|
|
197
|
+
PREVIEW_CHECKS,
|
|
198
|
+
PREVIEW_REPORT_SCHEMA_VERSION,
|
|
199
|
+
PREVIEW_SELECTABLE_CHECKS,
|
|
200
|
+
PreviewCheck,
|
|
201
|
+
PreviewOwner,
|
|
202
|
+
PreviewReport,
|
|
203
|
+
PreviewReportRow,
|
|
204
|
+
PreviewReportStage,
|
|
205
|
+
PreviewRowStatus,
|
|
206
|
+
PreviewStageStatus,
|
|
207
|
+
PreviewVerdict,
|
|
208
|
+
)
|
|
189
209
|
from simulo.interfaces.platform.runs import (
|
|
190
210
|
JOB_CANCEL_ROUTE_TEMPLATE,
|
|
191
211
|
JOB_LIST_SCOPES,
|
|
@@ -203,41 +223,61 @@ from simulo.interfaces.platform.runs import (
|
|
|
203
223
|
LOG_ARCHIVE_UNAVAILABLE_CODES,
|
|
204
224
|
LOG_CHUNK_MAX_BYTES,
|
|
205
225
|
LOG_TAIL_MAX_BYTES,
|
|
226
|
+
MAX_JOB_TAG_LENGTH,
|
|
227
|
+
MAX_JOB_TAGS,
|
|
206
228
|
TERMINAL_JOB_STATUSES,
|
|
229
|
+
normalize_job_tags,
|
|
207
230
|
)
|
|
208
231
|
from simulo.interfaces.platform.runtime import RuntimeProtocol
|
|
209
232
|
from simulo.interfaces.platform.submit import (
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
233
|
+
CHECKPOINT_IS_INPUT_CODE,
|
|
234
|
+
CHECKPOINT_KINDS,
|
|
235
|
+
CHECKPOINT_META_INVALID_CODE,
|
|
236
|
+
CHECKPOINT_NOT_ALLOWED_CODE,
|
|
237
|
+
CHECKPOINT_REF_IS_JOB_CODE,
|
|
238
|
+
CHECKPOINT_UNAVAILABLE_CODE,
|
|
239
|
+
CHECKPOINT_UPLOAD_MISSING_CODE,
|
|
240
|
+
EXPORTS_ROUTE,
|
|
241
|
+
INPUT_CHECKPOINT_NOT_ALLOWED_CODE,
|
|
213
242
|
JOB_RECORDING_DOWNLOAD_ROUTE_TEMPLATE,
|
|
214
243
|
JOB_RECORDINGS_ROUTE_TEMPLATE,
|
|
244
|
+
JOB_TYPE_MISMATCH_CODE,
|
|
215
245
|
MAX_COMPLETE_MESSAGE_CHARS,
|
|
216
246
|
MAX_COMPLETE_REASON_CODE_CHARS,
|
|
217
247
|
MAX_LOG_CHUNK_BYTES,
|
|
218
248
|
MAX_LOG_TOTAL_BYTES,
|
|
219
249
|
MAX_PACKAGE_BYTES,
|
|
220
250
|
MAX_RESULT_BYTES,
|
|
221
|
-
|
|
222
|
-
|
|
251
|
+
MAX_WORKER_RETIREMENT_DETAIL_CHARS,
|
|
252
|
+
NO_CHECKPOINT_SAVED_CODE,
|
|
253
|
+
NO_CHECKPOINT_SAVED_MESSAGE,
|
|
223
254
|
PACKAGE_ARCHIVE_ROUTE_TEMPLATE,
|
|
224
255
|
PACKAGES_ROUTE,
|
|
225
256
|
PLATFORM_PINNED_PACKAGES,
|
|
257
|
+
POLICIES_ROUTE,
|
|
258
|
+
POLICY_CHECKPOINT_DOWNLOAD_ROUTE_TEMPLATE,
|
|
259
|
+
POLICY_EXPORTS_ROUTE_TEMPLATE,
|
|
260
|
+
POLICY_NOT_FOUND_CODE,
|
|
261
|
+
POLICY_NOT_SEALED_CODE,
|
|
262
|
+
POLICY_ROUTE_TEMPLATE,
|
|
263
|
+
POLICY_SEALED_CODE,
|
|
226
264
|
RESERVED_RUNTIME_ENV_KEYS,
|
|
227
265
|
RESERVED_RUNTIME_ENV_PREFIXES,
|
|
228
|
-
SEED_JOB_REF_GRAMMAR,
|
|
229
|
-
SEED_SOURCE_CONFLICT_CODE,
|
|
230
|
-
SEED_SOURCE_FIELDS,
|
|
231
266
|
WORKER_BOOTSTRAP_ROUTE,
|
|
267
|
+
WORKER_CLAIM_INPUT_CHECKPOINT_FIELDS,
|
|
232
268
|
WORKER_CLAIM_ROUTE,
|
|
269
|
+
WORKER_JOB_CHECKPOINTS_PRESIGN_ROUTE_TEMPLATE,
|
|
270
|
+
WORKER_JOB_CHECKPOINTS_ROUTE_TEMPLATE,
|
|
233
271
|
WORKER_JOB_COMPLETE_ROUTE_TEMPLATE,
|
|
234
272
|
WORKER_JOB_HEARTBEAT_ROUTE_TEMPLATE,
|
|
235
273
|
WORKER_JOB_LOGS_ROUTE_TEMPLATE,
|
|
236
|
-
WORKER_JOB_MODELS_PRESIGN_ROUTE_TEMPLATE,
|
|
237
|
-
WORKER_JOB_MODELS_ROUTE_TEMPLATE,
|
|
238
274
|
WORKER_JOB_RECORDINGS_PRESIGN_ROUTE_TEMPLATE,
|
|
239
275
|
WORKER_JOB_RECORDINGS_ROUTE_TEMPLATE,
|
|
240
276
|
WORKER_LEASE_HEADER,
|
|
277
|
+
WORKER_RETIRE_ROUTE,
|
|
278
|
+
PolicyCheckpointRecord,
|
|
279
|
+
PolicyExportRecord,
|
|
280
|
+
PolicyRecord,
|
|
241
281
|
canonical_pypi_name,
|
|
242
282
|
is_platform_pinned,
|
|
243
283
|
)
|
|
@@ -246,6 +286,9 @@ from simulo.interfaces.platform.volume import VolumeProtocol
|
|
|
246
286
|
|
|
247
287
|
__all__ = [
|
|
248
288
|
# enums
|
|
289
|
+
"JobType",
|
|
290
|
+
"USER_SUBMITTABLE_JOB_TYPES",
|
|
291
|
+
"UNAVAILABLE_JOB_TYPES",
|
|
249
292
|
"OutputKind",
|
|
250
293
|
"SystemType",
|
|
251
294
|
# systems (GPU system-tier catalog, issue #1362)
|
|
@@ -285,7 +328,6 @@ __all__ = [
|
|
|
285
328
|
"Resource",
|
|
286
329
|
"Job",
|
|
287
330
|
"Checkpoint",
|
|
288
|
-
"TrainedModel",
|
|
289
331
|
# package manifest + version handshake + preflight contract (Plan A / #515, #533)
|
|
290
332
|
"Manifest",
|
|
291
333
|
"SUPPORTED_MANIFEST_VERSIONS",
|
|
@@ -320,6 +362,9 @@ __all__ = [
|
|
|
320
362
|
"OUTPUTS_UNDELIVERED_CODE",
|
|
321
363
|
"DECLARED_OUTPUT_MISSING_CODE",
|
|
322
364
|
# job-run contract (run record schema + jobs HTTP API shape)
|
|
365
|
+
"MAX_JOB_TAGS",
|
|
366
|
+
"MAX_JOB_TAG_LENGTH",
|
|
367
|
+
"normalize_job_tags",
|
|
323
368
|
"TERMINAL_JOB_STATUSES",
|
|
324
369
|
"JOBS_API_DEFAULT_PORT",
|
|
325
370
|
"JOBS_ROUTE",
|
|
@@ -349,18 +394,25 @@ __all__ = [
|
|
|
349
394
|
"PACKAGE_ARCHIVE_ROUTE_TEMPLATE",
|
|
350
395
|
"JOB_RECORDINGS_ROUTE_TEMPLATE",
|
|
351
396
|
"JOB_RECORDING_DOWNLOAD_ROUTE_TEMPLATE",
|
|
352
|
-
"
|
|
353
|
-
"
|
|
354
|
-
"
|
|
397
|
+
"POLICIES_ROUTE",
|
|
398
|
+
"POLICY_ROUTE_TEMPLATE",
|
|
399
|
+
"POLICY_CHECKPOINT_DOWNLOAD_ROUTE_TEMPLATE",
|
|
400
|
+
"EXPORTS_ROUTE",
|
|
401
|
+
"POLICY_EXPORTS_ROUTE_TEMPLATE",
|
|
402
|
+
"PolicyRecord",
|
|
403
|
+
"PolicyCheckpointRecord",
|
|
404
|
+
"PolicyExportRecord",
|
|
355
405
|
"WORKER_BOOTSTRAP_ROUTE",
|
|
356
406
|
"WORKER_CLAIM_ROUTE",
|
|
407
|
+
"WORKER_RETIRE_ROUTE",
|
|
357
408
|
"WORKER_JOB_LOGS_ROUTE_TEMPLATE",
|
|
358
409
|
"WORKER_JOB_HEARTBEAT_ROUTE_TEMPLATE",
|
|
359
410
|
"WORKER_JOB_COMPLETE_ROUTE_TEMPLATE",
|
|
360
411
|
"WORKER_JOB_RECORDINGS_PRESIGN_ROUTE_TEMPLATE",
|
|
361
412
|
"WORKER_JOB_RECORDINGS_ROUTE_TEMPLATE",
|
|
362
|
-
"
|
|
363
|
-
"
|
|
413
|
+
"WORKER_JOB_CHECKPOINTS_PRESIGN_ROUTE_TEMPLATE",
|
|
414
|
+
"WORKER_JOB_CHECKPOINTS_ROUTE_TEMPLATE",
|
|
415
|
+
"WORKER_CLAIM_INPUT_CHECKPOINT_FIELDS",
|
|
364
416
|
"WORKER_LEASE_HEADER",
|
|
365
417
|
"MAX_PACKAGE_BYTES",
|
|
366
418
|
"MAX_LOG_CHUNK_BYTES",
|
|
@@ -368,17 +420,26 @@ __all__ = [
|
|
|
368
420
|
"MAX_RESULT_BYTES",
|
|
369
421
|
"MAX_COMPLETE_MESSAGE_CHARS",
|
|
370
422
|
"MAX_COMPLETE_REASON_CODE_CHARS",
|
|
371
|
-
"
|
|
423
|
+
"MAX_WORKER_RETIREMENT_DETAIL_CHARS",
|
|
424
|
+
"CHECKPOINT_KINDS",
|
|
372
425
|
"RESERVED_RUNTIME_ENV_KEYS",
|
|
373
426
|
"RESERVED_RUNTIME_ENV_PREFIXES",
|
|
374
427
|
"PLATFORM_PINNED_PACKAGES",
|
|
375
428
|
"is_platform_pinned",
|
|
376
429
|
"canonical_pypi_name",
|
|
377
|
-
|
|
378
|
-
"
|
|
379
|
-
"
|
|
380
|
-
"
|
|
381
|
-
"
|
|
430
|
+
"NO_CHECKPOINT_SAVED_CODE",
|
|
431
|
+
"NO_CHECKPOINT_SAVED_MESSAGE",
|
|
432
|
+
"POLICY_NOT_FOUND_CODE",
|
|
433
|
+
"POLICY_NOT_SEALED_CODE",
|
|
434
|
+
"CHECKPOINT_UNAVAILABLE_CODE",
|
|
435
|
+
"CHECKPOINT_REF_IS_JOB_CODE",
|
|
436
|
+
"INPUT_CHECKPOINT_NOT_ALLOWED_CODE",
|
|
437
|
+
"CHECKPOINT_IS_INPUT_CODE",
|
|
438
|
+
"POLICY_SEALED_CODE",
|
|
439
|
+
"CHECKPOINT_NOT_ALLOWED_CODE",
|
|
440
|
+
"CHECKPOINT_UPLOAD_MISSING_CODE",
|
|
441
|
+
"CHECKPOINT_META_INVALID_CODE",
|
|
442
|
+
"JOB_TYPE_MISMATCH_CODE",
|
|
382
443
|
# USD Asset Catalogs wire contract (PR-1) — ref grammar
|
|
383
444
|
"parse_asset_ref",
|
|
384
445
|
"format_asset_ref",
|
|
@@ -475,6 +536,7 @@ __all__ = [
|
|
|
475
536
|
"policy_bundle_root_dir",
|
|
476
537
|
"policy_bundle_archive_name",
|
|
477
538
|
"JOB_EXPORTS_ROUTE_TEMPLATE",
|
|
539
|
+
"EXPORT_JOB_TYPE",
|
|
478
540
|
"EXPORT_VALIDATION_JOB_TYPE",
|
|
479
541
|
"POLICY_EQUIVALENCE_ABS_TOLERANCE",
|
|
480
542
|
"POLICY_EQUIVALENCE_REL_TOLERANCE",
|
|
@@ -498,6 +560,19 @@ __all__ = [
|
|
|
498
560
|
"PolicyActionSchema",
|
|
499
561
|
"PolicyNormalization",
|
|
500
562
|
"validate_policy_bundle",
|
|
563
|
+
# preview report wire contract — schema version, check names, and the
|
|
564
|
+
# row/stage/report shapes the preview job returns
|
|
565
|
+
"PREVIEW_REPORT_SCHEMA_VERSION",
|
|
566
|
+
"PREVIEW_CHECKS",
|
|
567
|
+
"PREVIEW_SELECTABLE_CHECKS",
|
|
568
|
+
"PreviewCheck",
|
|
569
|
+
"PreviewRowStatus",
|
|
570
|
+
"PreviewStageStatus",
|
|
571
|
+
"PreviewVerdict",
|
|
572
|
+
"PreviewOwner",
|
|
573
|
+
"PreviewReportRow",
|
|
574
|
+
"PreviewReportStage",
|
|
575
|
+
"PreviewReport",
|
|
501
576
|
# protocols
|
|
502
577
|
"RuntimeProtocol",
|
|
503
578
|
"AssetProtocol",
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"""User-facing job-container Protocols (Part B) — ``App`` / ``@app.job`` surface."""
|
|
2
2
|
|
|
3
|
-
from typing import
|
|
3
|
+
from typing import (
|
|
4
|
+
Any,
|
|
5
|
+
Callable,
|
|
6
|
+
Mapping,
|
|
7
|
+
Optional,
|
|
8
|
+
Protocol,
|
|
9
|
+
Sequence,
|
|
10
|
+
TypeVar,
|
|
11
|
+
Union,
|
|
12
|
+
overload,
|
|
13
|
+
runtime_checkable,
|
|
14
|
+
)
|
|
4
15
|
|
|
5
16
|
from simulo.interfaces.ids import JobId
|
|
6
17
|
from simulo.interfaces.platform.asset import AssetProtocol
|
|
7
18
|
from simulo.interfaces.platform.callbacks import JobCallbackProtocol
|
|
8
|
-
from simulo.interfaces.platform.enums import
|
|
19
|
+
from simulo.interfaces.platform.enums import JobType, SystemType
|
|
9
20
|
from simulo.interfaces.platform.runtime import RuntimeProtocol
|
|
10
21
|
from simulo.interfaces.platform.volume import VolumeProtocol
|
|
11
22
|
|
|
@@ -55,22 +66,53 @@ class AppProtocol(Protocol):
|
|
|
55
66
|
"""The assets/volumes mounted into every job of this app, by name."""
|
|
56
67
|
...
|
|
57
68
|
|
|
58
|
-
@
|
|
59
|
-
def
|
|
69
|
+
@property
|
|
70
|
+
def job_declarations(self) -> tuple[tuple[str, object], ...]:
|
|
71
|
+
"""Every job declaration, including duplicate function names."""
|
|
72
|
+
...
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def success_functions(self) -> tuple[Callable[..., object], ...]:
|
|
76
|
+
"""Evaluation success predicates, in declaration order."""
|
|
77
|
+
...
|
|
78
|
+
|
|
60
79
|
@overload
|
|
61
80
|
def job(
|
|
62
|
-
self,
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
type: Union[JobType, str],
|
|
84
|
+
callbacks: Sequence[JobCallbackProtocol] = ...,
|
|
85
|
+
system: Optional[SystemType] = ...,
|
|
86
|
+
timeout: Optional[int] = ...,
|
|
87
|
+
retries: int = ...,
|
|
88
|
+
**extra: Any,
|
|
63
89
|
) -> Callable[[F], JobFunctionProtocol]: ...
|
|
90
|
+
@overload
|
|
91
|
+
def job(
|
|
92
|
+
self,
|
|
93
|
+
fn: F,
|
|
94
|
+
*,
|
|
95
|
+
type: Union[JobType, str],
|
|
96
|
+
callbacks: Sequence[JobCallbackProtocol] = ...,
|
|
97
|
+
system: Optional[SystemType] = ...,
|
|
98
|
+
timeout: Optional[int] = ...,
|
|
99
|
+
retries: int = ...,
|
|
100
|
+
**extra: Any,
|
|
101
|
+
) -> JobFunctionProtocol: ...
|
|
64
102
|
def job(
|
|
65
103
|
self,
|
|
66
104
|
fn: Optional[F] = None,
|
|
67
105
|
*,
|
|
106
|
+
type: Optional[Union[JobType, str]] = None,
|
|
68
107
|
callbacks: Sequence[JobCallbackProtocol] = (),
|
|
69
|
-
|
|
108
|
+
system: Optional[SystemType] = None,
|
|
109
|
+
timeout: Optional[int] = None,
|
|
110
|
+
retries: int = 0,
|
|
111
|
+
**extra: Any,
|
|
70
112
|
) -> Union[JobFunctionProtocol, Callable[[F], JobFunctionProtocol]]:
|
|
71
|
-
"""Register a
|
|
113
|
+
"""Register a typed job with its submission metadata."""
|
|
72
114
|
...
|
|
73
115
|
|
|
74
|
-
def
|
|
75
|
-
"""Register
|
|
116
|
+
def success(self, fn: F) -> F:
|
|
117
|
+
"""Register an evaluation success predicate."""
|
|
76
118
|
...
|