reactor-runtime 3.11.0__tar.gz → 3.11.2__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.
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/PKG-INFO +2 -2
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/pyproject.toml +4 -4
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/pyproject.toml.orig +4 -4
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/__init__.py +4 -2
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/service.py +79 -51
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/manifest.py +176 -36
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/__init__.py +16 -14
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/__main__.py +9 -7
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/batching.py +3 -3
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/client.py +25 -25
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/config.py +11 -7
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/connection.py +2 -2
- reactor_runtime-3.11.2/src/reactor_runtime/model_server/errors.py +166 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/link.py +5 -5
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/process.py +34 -20
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/protocol.py +18 -18
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/server.py +47 -36
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/worker.py → reactor_runtime-3.11.2/src/reactor_runtime/model_server/server_core.py +22 -22
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/model_server/shm_link.py +27 -24
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/errors.py +0 -128
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/LICENSE +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/NOTICE +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/README.md +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/codes.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/fields.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/model.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/naming.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/session.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/stages.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/stats.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/transport.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/typespec.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/core/values.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/errors.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/protocol.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/rank.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/runner.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/distributed/worker.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/environment.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/event_stream.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/events.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/routes.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/server.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/spec.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/http/step_usage.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/app/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/app/input_state.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/app/outcome.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/app/reactor_app.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/app/step_completed.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/client.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/events/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/events/decorators.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/events/errors.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/events/messages.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/internal/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/internal/aliases.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/internal/bridge.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/internal/input_buffer.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/internal/reactor_core.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/model/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/model/contract.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/model/reactor_model.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/model/schema.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/pipeline/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/pipeline/idle.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/pipeline/input_state.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/pipeline/reactor_pipeline.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/tracks/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/tracks/descriptors.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/tracks/input.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/interface/tracks/output.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/ipc/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/ipc/blocks.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/ipc/payload.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/ipc/slot.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/log.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/message_gateway.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/metrics/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/metrics/command.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/metrics/model.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/metrics/registry.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/metrics/session.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/paths.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/base.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/common.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/frames.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/v0/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/v0/codec.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/v1/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/protocol/v1/codec.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/py.typed +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/recording/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/recording/chunk_encoder.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/recording/markers.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/recording/recorder.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/client_stats.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/connection_manager.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/offer_epochs.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/runner.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/runtime_stats.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/session_start.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/stages.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/state_machine.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/system_client.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/runner/upload_resolution.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/schema.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/serve.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/service.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/step_results/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/step_results/mp4.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/step_results/store.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/step_results/usage.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/acceptor.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/connection.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/media_in.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/pacer.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/participant.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/room.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/router.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/signals.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/livekit/version.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/router.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/step_frames.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/__init__.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/acceptor.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/client_stats.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/config.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/connection.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/frame_stages.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/frames.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/message_stages.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/metrics.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/pacer.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/peer.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/reading.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/router.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/sdp.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/signaling.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/stats.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/transport/webrtc/version.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_runtime/upload_store.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/common_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/common_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/control_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/control_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/data_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/data_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/model_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/model_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/platform_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/platform_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/step_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/step_pb2.pyi +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/track_pb2.py +0 -0
- {reactor_runtime-3.11.0 → reactor_runtime-3.11.2}/src/reactor_wire/v1/track_pb2.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: reactor-runtime
|
|
3
|
-
Version: 3.11.
|
|
3
|
+
Version: 3.11.2
|
|
4
4
|
Summary: A Python framework for building real-time, interactive video models
|
|
5
5
|
Author: Reactor
|
|
6
6
|
Author-email: Reactor <team@reactor.inc>
|
|
@@ -21,7 +21,7 @@ Requires-Dist: protobuf>=7.35.1
|
|
|
21
21
|
Requires-Dist: pyyaml>=6.0.3
|
|
22
22
|
Requires-Dist: reactor-webrtc==0.24.2
|
|
23
23
|
Requires-Dist: uvicorn>=0.49.0
|
|
24
|
-
Requires-Dist: livekit==1.
|
|
24
|
+
Requires-Dist: livekit==1.2.0 ; extra == 'livekit'
|
|
25
25
|
Requires-Python: >=3.12
|
|
26
26
|
Project-URL: Source, https://github.com/reactor-team/reactor-runtime
|
|
27
27
|
Provides-Extra: livekit
|
|
@@ -79,7 +79,7 @@ extra-paths = [
|
|
|
79
79
|
"tests/contract",
|
|
80
80
|
"endurance-tests",
|
|
81
81
|
"endurance-tests/model",
|
|
82
|
-
"endurance-tests/model-
|
|
82
|
+
"endurance-tests/model-split",
|
|
83
83
|
]
|
|
84
84
|
|
|
85
85
|
[tool.ty.src]
|
|
@@ -107,7 +107,7 @@ pythonpath = [
|
|
|
107
107
|
|
|
108
108
|
[project]
|
|
109
109
|
name = "reactor-runtime"
|
|
110
|
-
version = "3.11.
|
|
110
|
+
version = "3.11.2"
|
|
111
111
|
description = "A Python framework for building real-time, interactive video models"
|
|
112
112
|
readme = "README.md"
|
|
113
113
|
license = "Apache-2.0"
|
|
@@ -140,7 +140,7 @@ name = "Reactor"
|
|
|
140
140
|
email = "team@reactor.inc"
|
|
141
141
|
|
|
142
142
|
[project.optional-dependencies]
|
|
143
|
-
livekit = ["livekit==1.
|
|
143
|
+
livekit = ["livekit==1.2.0"]
|
|
144
144
|
|
|
145
145
|
[project.urls]
|
|
146
146
|
Source = "https://github.com/reactor-team/reactor-runtime"
|
|
@@ -149,7 +149,7 @@ Source = "https://github.com/reactor-team/reactor-runtime"
|
|
|
149
149
|
dev = [
|
|
150
150
|
"certifi>=2026.10.19",
|
|
151
151
|
"httpx>=0.28.1",
|
|
152
|
-
"livekit==1.
|
|
152
|
+
"livekit==1.2.0",
|
|
153
153
|
"livekit-api>=1.2.2",
|
|
154
154
|
"opencv-python-headless>=4.10",
|
|
155
155
|
"pillow>=10.1",
|
|
@@ -20,7 +20,7 @@ version = "1.20261024.19"
|
|
|
20
20
|
|
|
21
21
|
[project]
|
|
22
22
|
name = "reactor-runtime"
|
|
23
|
-
version = "3.11.
|
|
23
|
+
version = "3.11.2"
|
|
24
24
|
description = "A Python framework for building real-time, interactive video models"
|
|
25
25
|
readme = "README.md"
|
|
26
26
|
license = "Apache-2.0"
|
|
@@ -50,7 +50,7 @@ dependencies = [
|
|
|
50
50
|
# The LiveKit transport. A model that joins LiveKit rooms lists
|
|
51
51
|
# `reactor-runtime[livekit]` in its requirements; the runtime pin stays the
|
|
52
52
|
# CLI's `build.runtime_version`.
|
|
53
|
-
livekit = ["livekit==1.
|
|
53
|
+
livekit = ["livekit==1.2.0"]
|
|
54
54
|
|
|
55
55
|
[project.urls]
|
|
56
56
|
Source = "https://github.com/reactor-team/reactor-runtime"
|
|
@@ -60,7 +60,7 @@ dev = [
|
|
|
60
60
|
"certifi>=2026.10.19",
|
|
61
61
|
"httpx>=0.28.1",
|
|
62
62
|
# The LiveKit transport and the token minting its tests use.
|
|
63
|
-
"livekit==1.
|
|
63
|
+
"livekit==1.2.0",
|
|
64
64
|
"livekit-api>=1.2.2",
|
|
65
65
|
"opencv-python-headless>=4.10",
|
|
66
66
|
"pillow>=10.1",
|
|
@@ -155,7 +155,7 @@ extra-paths = [
|
|
|
155
155
|
"tests/contract",
|
|
156
156
|
"endurance-tests",
|
|
157
157
|
"endurance-tests/model",
|
|
158
|
-
"endurance-tests/model-
|
|
158
|
+
"endurance-tests/model-split",
|
|
159
159
|
]
|
|
160
160
|
|
|
161
161
|
[tool.ty.src]
|
|
@@ -28,11 +28,12 @@ from reactor_runtime.core.service import (
|
|
|
28
28
|
LiveKitBlockError,
|
|
29
29
|
LiveKitConfig,
|
|
30
30
|
LiveKitRpcMethod,
|
|
31
|
+
ModelServerConfig,
|
|
31
32
|
RecordingConfig,
|
|
32
33
|
RuntimeConfig,
|
|
33
34
|
ServiceComponent,
|
|
35
|
+
SharedMemoryConfig,
|
|
34
36
|
StepResultsConfig,
|
|
35
|
-
WorkerConfig,
|
|
36
37
|
shm_slot_bytes,
|
|
37
38
|
)
|
|
38
39
|
from reactor_runtime.core.session import (
|
|
@@ -124,6 +125,7 @@ __all__ = [
|
|
|
124
125
|
"MessageObserver",
|
|
125
126
|
"MessageStage",
|
|
126
127
|
"MessageStageSource",
|
|
128
|
+
"ModelServerConfig",
|
|
127
129
|
"ReactorEvent",
|
|
128
130
|
"RecordingConfig",
|
|
129
131
|
"ReplyRoute",
|
|
@@ -135,6 +137,7 @@ __all__ = [
|
|
|
135
137
|
"SessionEvent",
|
|
136
138
|
"SessionStarted",
|
|
137
139
|
"SessionState",
|
|
140
|
+
"SharedMemoryConfig",
|
|
138
141
|
"StartingInputApplied",
|
|
139
142
|
"StepRefusal",
|
|
140
143
|
"StepRefusalKind",
|
|
@@ -150,6 +153,5 @@ __all__ = [
|
|
|
150
153
|
"TransportTrackReading",
|
|
151
154
|
"TypeSpec",
|
|
152
155
|
"UploadedFile",
|
|
153
|
-
"WorkerConfig",
|
|
154
156
|
"shm_slot_bytes",
|
|
155
157
|
]
|
|
@@ -215,14 +215,16 @@ class LiveKitConfig:
|
|
|
215
215
|
|
|
216
216
|
|
|
217
217
|
DEFAULT_SHM_INPUT_BYTES = 1 << 20
|
|
218
|
-
"""Each
|
|
218
|
+
"""Each worker's request block when ``model.resources.workers.shared_memory`` sets no
|
|
219
|
+
``input``: 1 MiB."""
|
|
219
220
|
|
|
220
221
|
DEFAULT_SHM_OUTPUT_BYTES = 32 << 20
|
|
221
|
-
"""Each
|
|
222
|
+
"""Each worker's output block when ``model.resources.workers.shared_memory`` sets no
|
|
223
|
+
``output``: 32 MiB.
|
|
222
224
|
|
|
223
225
|
Sized for a step that returns video. A model whose results are larger sets
|
|
224
|
-
``
|
|
225
|
-
since every
|
|
226
|
+
``model.resources.workers.shared_memory.output``; one whose results are small
|
|
227
|
+
sets it lower, since every worker's blocks are reserved up front.
|
|
226
228
|
"""
|
|
227
229
|
|
|
228
230
|
|
|
@@ -250,38 +252,78 @@ def _whole_pages(size: int) -> int:
|
|
|
250
252
|
|
|
251
253
|
|
|
252
254
|
@dataclass(frozen=True)
|
|
253
|
-
class
|
|
254
|
-
"""
|
|
255
|
+
class SharedMemoryConfig:
|
|
256
|
+
"""Each worker's shared-memory blocks, from ``model.resources.workers.shared_memory``.
|
|
255
257
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
The workers of a split model are its session runtimes, one per session,
|
|
259
|
+
beside one model server. Each worker exchanges a step with the model server
|
|
260
|
+
through a request block it writes and an output block the model server
|
|
261
|
+
writes, both created at these sizes and never grown. A deployment sizes
|
|
262
|
+
each worker's memory-backed volume from the same manifest keys, so what the
|
|
263
|
+
manifest declares is what a deployment gives the model.
|
|
264
|
+
|
|
265
|
+
Attributes:
|
|
266
|
+
input_bytes: Each worker's request block, from
|
|
267
|
+
``model.resources.workers.shared_memory.input``;
|
|
268
|
+
:data:`DEFAULT_SHM_INPUT_BYTES` (1 MiB) when unset. A request whose
|
|
269
|
+
arrays need more is refused.
|
|
270
|
+
output_bytes: Each worker's output block, from
|
|
271
|
+
``model.resources.workers.shared_memory.output``;
|
|
272
|
+
:data:`DEFAULT_SHM_OUTPUT_BYTES` (32 MiB) when unset. A result
|
|
273
|
+
whose arrays need more is refused.
|
|
274
|
+
|
|
275
|
+
Raises:
|
|
276
|
+
ValueError: A size is not a positive integer, naming its manifest key.
|
|
277
|
+
"""
|
|
278
|
+
|
|
279
|
+
input_bytes: int = DEFAULT_SHM_INPUT_BYTES
|
|
280
|
+
output_bytes: int = DEFAULT_SHM_OUTPUT_BYTES
|
|
281
|
+
|
|
282
|
+
def __post_init__(self) -> None:
|
|
283
|
+
"""Refuse a size that is not a positive integer, naming its key."""
|
|
284
|
+
for key, value in (("input", self.input_bytes), ("output", self.output_bytes)):
|
|
285
|
+
if type(value) is not int or value < 1:
|
|
286
|
+
raise ValueError(
|
|
287
|
+
f"model.resources.workers.shared_memory.{key} must be a positive number "
|
|
288
|
+
f"of bytes, got {value!r}"
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
@property
|
|
292
|
+
def slot_bytes(self) -> int:
|
|
293
|
+
"""The most shared memory one worker's slot holds, which its volume must fit.
|
|
294
|
+
|
|
295
|
+
:func:`shm_slot_bytes` of :attr:`input_bytes` and :attr:`output_bytes`.
|
|
296
|
+
A deployment gives each worker's memory-backed volume at least this.
|
|
297
|
+
"""
|
|
298
|
+
return shm_slot_bytes(self.input_bytes, self.output_bytes)
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
@dataclass(frozen=True)
|
|
302
|
+
class ModelServerConfig:
|
|
303
|
+
"""The model half of a split model, drawn from the manifest's ``runtime.model_server`` block.
|
|
304
|
+
|
|
305
|
+
Read by the model server's entry point, ``python -m
|
|
306
|
+
reactor_runtime.model_server``. The block takes ``import``, ``max_batch``
|
|
307
|
+
and ``batch_window``; the shared memory each worker exchanges with the
|
|
308
|
+
model server is sized in ``model.resources.workers.shared_memory``
|
|
309
|
+
(:class:`SharedMemoryConfig`).
|
|
260
310
|
|
|
261
311
|
Attributes:
|
|
262
312
|
import_ref: The model half, a ``ModelServer`` subclass, as ``"module:Class"``.
|
|
263
313
|
max_batch: The most requests one step receives; ``None`` keeps the
|
|
264
314
|
class's ``max_batch``, which this may only lower.
|
|
265
|
-
batch_window: Seconds the
|
|
266
|
-
keeps the class's ``batch_window``.
|
|
267
|
-
shm_input_bytes: Each session's request block as the block declares
|
|
268
|
-
it, ``None`` when it declares none; :attr:`input_bytes` is the
|
|
269
|
-
size used.
|
|
270
|
-
shm_output_bytes: Each session's output block as the block declares
|
|
271
|
-
it, ``None`` when it declares none; :attr:`output_bytes` is the
|
|
272
|
-
size used.
|
|
315
|
+
batch_window: Seconds the model server waits for a batch to fill;
|
|
316
|
+
``None`` keeps the class's ``batch_window``.
|
|
273
317
|
|
|
274
318
|
Raises:
|
|
275
|
-
ValueError: ``import`` is not ``"module:Class"`` with both parts,
|
|
276
|
-
|
|
277
|
-
|
|
319
|
+
ValueError: ``import`` is not ``"module:Class"`` with both parts,
|
|
320
|
+
``max_batch`` is not a positive integer, or ``batch_window`` is not
|
|
321
|
+
a finite number of seconds, at least 0.
|
|
278
322
|
"""
|
|
279
323
|
|
|
280
324
|
import_ref: str
|
|
281
325
|
max_batch: int | None = None
|
|
282
326
|
batch_window: float | None = None
|
|
283
|
-
shm_input_bytes: int | None = None
|
|
284
|
-
shm_output_bytes: int | None = None
|
|
285
327
|
|
|
286
328
|
def __post_init__(self) -> None:
|
|
287
329
|
"""Refuse a value of the wrong type or range, naming its key."""
|
|
@@ -290,41 +332,23 @@ class WorkerConfig:
|
|
|
290
332
|
)
|
|
291
333
|
if not separator or not module or not name:
|
|
292
334
|
raise ValueError(
|
|
293
|
-
f"runtime.
|
|
335
|
+
f"runtime.model_server.import must name the model half as 'module:Class', "
|
|
294
336
|
f"got {self.import_ref!r}"
|
|
295
337
|
)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
338
|
+
max_batch = self.max_batch
|
|
339
|
+
if max_batch is not None and (type(max_batch) is not int or max_batch < 1):
|
|
340
|
+
raise ValueError(
|
|
341
|
+
f"runtime.model_server.max_batch must be a positive integer, got {max_batch!r}"
|
|
342
|
+
)
|
|
300
343
|
window = self.batch_window
|
|
301
344
|
if window is not None and (
|
|
302
345
|
type(window) not in (int, float) or not 0 <= window < float("inf")
|
|
303
346
|
):
|
|
304
347
|
raise ValueError(
|
|
305
|
-
f"runtime.
|
|
348
|
+
f"runtime.model_server.batch_window must be a number of seconds, at least 0, "
|
|
306
349
|
f"got {window!r}"
|
|
307
350
|
)
|
|
308
351
|
|
|
309
|
-
@property
|
|
310
|
-
def input_bytes(self) -> int:
|
|
311
|
-
"""Each session's request block: the declared size, or :data:`DEFAULT_SHM_INPUT_BYTES`."""
|
|
312
|
-
return self.shm_input_bytes or DEFAULT_SHM_INPUT_BYTES
|
|
313
|
-
|
|
314
|
-
@property
|
|
315
|
-
def output_bytes(self) -> int:
|
|
316
|
-
"""Each session's output block: the declared size, or :data:`DEFAULT_SHM_OUTPUT_BYTES`."""
|
|
317
|
-
return self.shm_output_bytes or DEFAULT_SHM_OUTPUT_BYTES
|
|
318
|
-
|
|
319
|
-
@property
|
|
320
|
-
def shm_slot_bytes(self) -> int:
|
|
321
|
-
"""The most shared memory one session's slot holds, with the defaults for what is unset.
|
|
322
|
-
|
|
323
|
-
:func:`shm_slot_bytes` of :attr:`input_bytes` and :attr:`output_bytes`.
|
|
324
|
-
A deployment gives each session's memory-backed volume at least this.
|
|
325
|
-
"""
|
|
326
|
-
return shm_slot_bytes(self.input_bytes, self.output_bytes)
|
|
327
|
-
|
|
328
352
|
|
|
329
353
|
@dataclass(frozen=True)
|
|
330
354
|
class RuntimeConfig:
|
|
@@ -352,8 +376,11 @@ class RuntimeConfig:
|
|
|
352
376
|
recording: The recorder's configuration; disabled by default.
|
|
353
377
|
step_results: How each finished step is saved; disabled by default.
|
|
354
378
|
livekit: How a LiveKit room reaches the model; empty by default.
|
|
355
|
-
|
|
356
|
-
``None`` for a model that does not split.
|
|
379
|
+
model_server: The model half of a model split in two, from
|
|
380
|
+
``runtime.model_server``; ``None`` for a model that does not split.
|
|
381
|
+
shared_memory: Each worker's shared-memory blocks for a split model,
|
|
382
|
+
from ``model.resources.workers.shared_memory``; the defaults when
|
|
383
|
+
the manifest sets none.
|
|
357
384
|
"""
|
|
358
385
|
|
|
359
386
|
model_ref: str
|
|
@@ -367,4 +394,5 @@ class RuntimeConfig:
|
|
|
367
394
|
recording: RecordingConfig = field(default_factory=RecordingConfig)
|
|
368
395
|
step_results: StepResultsConfig = field(default_factory=StepResultsConfig)
|
|
369
396
|
livekit: LiveKitConfig = field(default_factory=LiveKitConfig)
|
|
370
|
-
|
|
397
|
+
model_server: ModelServerConfig | None = None
|
|
398
|
+
shared_memory: SharedMemoryConfig = field(default_factory=SharedMemoryConfig)
|
|
@@ -5,12 +5,13 @@ The ``reactor.yaml`` manifest is the runtime's one configuration file:
|
|
|
5
5
|
``runtime.config`` points at the model's own config file, the
|
|
6
6
|
``runtime.recording`` block configures the recorder, the
|
|
7
7
|
``runtime.step_results`` block says how each finished step is saved, the
|
|
8
|
-
``runtime.livekit`` block says how a LiveKit room reaches the model,
|
|
9
|
-
``runtime.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
the
|
|
8
|
+
``runtime.livekit`` block says how a LiveKit room reaches the model, the
|
|
9
|
+
``runtime.model_server`` block names the model half of a model split in two,
|
|
10
|
+
and ``model.resources.workers.shared_memory`` sizes the shared memory each of
|
|
11
|
+
that model's workers exchanges with its model server. This module turns that
|
|
12
|
+
file into a :class:`~reactor_runtime.core.RuntimeConfig` and the reference into
|
|
13
|
+
the model class — and it is the only code that does either, so every entry
|
|
14
|
+
point resolves the same model from the same directory.
|
|
14
15
|
|
|
15
16
|
The module stays deliberately light: it needs YAML and the core config types,
|
|
16
17
|
nothing from the server or the transport stack. Rendering a model's schema
|
|
@@ -20,7 +21,10 @@ imports it without dragging an ASGI server or a media engine along.
|
|
|
20
21
|
from __future__ import annotations
|
|
21
22
|
|
|
22
23
|
import importlib
|
|
24
|
+
import re
|
|
23
25
|
import sys
|
|
26
|
+
from decimal import Decimal
|
|
27
|
+
from fractions import Fraction
|
|
24
28
|
from pathlib import Path
|
|
25
29
|
from typing import TYPE_CHECKING, Any
|
|
26
30
|
|
|
@@ -30,11 +34,12 @@ from reactor_runtime.core import (
|
|
|
30
34
|
LiveKitBlockError,
|
|
31
35
|
LiveKitConfig,
|
|
32
36
|
LiveKitRpcMethod,
|
|
37
|
+
ModelServerConfig,
|
|
33
38
|
RecordingConfig,
|
|
34
39
|
RuntimeConfig,
|
|
40
|
+
SharedMemoryConfig,
|
|
35
41
|
StepResultsConfig,
|
|
36
42
|
TrackDirection,
|
|
37
|
-
WorkerConfig,
|
|
38
43
|
)
|
|
39
44
|
from reactor_runtime.interface.internal.reactor_core import ReactorCore
|
|
40
45
|
|
|
@@ -51,11 +56,13 @@ def load_config(manifest: Path) -> RuntimeConfig:
|
|
|
51
56
|
``runtime.config`` — the path to the model's own config file — name the
|
|
52
57
|
model, ``model.name`` is the name it is published under, the
|
|
53
58
|
``runtime.recording`` block configures the recorder, the
|
|
54
|
-
``runtime.step_results`` block configures step results,
|
|
55
|
-
``runtime.livekit`` block configures room sessions
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
the
|
|
59
|
+
``runtime.step_results`` block configures step results, the
|
|
60
|
+
``runtime.livekit`` block configures room sessions, and the
|
|
61
|
+
``runtime.model_server`` block with ``model.resources.workers.shared_memory``
|
|
62
|
+
configures a model split in two; the rest of the manifest, the rest of
|
|
63
|
+
``model.resources`` included, describes the model to the platform and is
|
|
64
|
+
not the runtime's concern. The config path is passed to the model verbatim
|
|
65
|
+
(resolved to an absolute path); the runtime never parses its contents.
|
|
59
66
|
|
|
60
67
|
Args:
|
|
61
68
|
manifest: Path to the ``reactor.yaml`` file.
|
|
@@ -63,14 +70,16 @@ def load_config(manifest: Path) -> RuntimeConfig:
|
|
|
63
70
|
Returns:
|
|
64
71
|
A configuration naming the model the manifest points at, the name it
|
|
65
72
|
publishes under, the path to its config file when present, the
|
|
66
|
-
recorder's settings, the step-results settings,
|
|
73
|
+
recorder's settings, the step-results settings, the room settings, and
|
|
74
|
+
a split model's model server and shared-memory settings.
|
|
67
75
|
|
|
68
76
|
Raises:
|
|
69
77
|
SystemExit: If the manifest is not valid YAML, is not a mapping, or
|
|
70
78
|
carries no ``runtime.import``.
|
|
71
79
|
ValueError: If a block the runtime refuses to guess about has the
|
|
72
80
|
wrong shape: a ``step_results.queue`` below 1, a malformed
|
|
73
|
-
``livekit`` block,
|
|
81
|
+
``livekit`` block, a malformed ``model_server`` block, or a
|
|
82
|
+
malformed ``model.resources.workers.shared_memory`` block.
|
|
74
83
|
"""
|
|
75
84
|
try:
|
|
76
85
|
document = yaml.safe_load(manifest.read_text())
|
|
@@ -90,7 +99,8 @@ def load_config(manifest: Path) -> RuntimeConfig:
|
|
|
90
99
|
recording=_recording_from_manifest(runtime, document),
|
|
91
100
|
step_results=_step_results_from_manifest(runtime),
|
|
92
101
|
livekit=_livekit_from_manifest(runtime),
|
|
93
|
-
|
|
102
|
+
model_server=_model_server_from_manifest(runtime),
|
|
103
|
+
shared_memory=_shared_memory_from_manifest(document.get("model")),
|
|
94
104
|
)
|
|
95
105
|
|
|
96
106
|
|
|
@@ -134,56 +144,186 @@ def _model_name(block: Any) -> str | None:
|
|
|
134
144
|
return name if isinstance(name, str) and name else None
|
|
135
145
|
|
|
136
146
|
|
|
137
|
-
|
|
147
|
+
_MODEL_SERVER_KEYS = {
|
|
138
148
|
"import": "import_ref",
|
|
139
149
|
"max_batch": "max_batch",
|
|
140
150
|
"batch_window": "batch_window",
|
|
141
|
-
"shm_input_bytes": "shm_input_bytes",
|
|
142
|
-
"shm_output_bytes": "shm_output_bytes",
|
|
143
151
|
}
|
|
144
152
|
|
|
145
153
|
|
|
146
|
-
def
|
|
147
|
-
"""Parse the manifest's ``runtime.
|
|
154
|
+
def _model_server_from_manifest(runtime: dict[str, Any]) -> ModelServerConfig | None:
|
|
155
|
+
"""Parse the manifest's ``runtime.model_server`` block into a :class:`ModelServerConfig`.
|
|
148
156
|
|
|
149
157
|
The block names the model half and its serving settings::
|
|
150
158
|
|
|
151
159
|
runtime:
|
|
152
160
|
import: plasma:Plasma
|
|
153
|
-
|
|
154
|
-
import:
|
|
161
|
+
model_server:
|
|
162
|
+
import: plasma_model:PlasmaModel
|
|
155
163
|
max_batch: 2
|
|
156
|
-
|
|
164
|
+
batch_window: 0.005
|
|
157
165
|
|
|
158
|
-
An unknown key is refused rather than ignored: a misspelt
|
|
159
|
-
otherwise leave
|
|
166
|
+
An unknown key is refused rather than ignored: a misspelt setting would
|
|
167
|
+
otherwise leave the model server at its class's value without a word.
|
|
160
168
|
|
|
161
169
|
Args:
|
|
162
170
|
runtime: The manifest's ``runtime`` section.
|
|
163
171
|
|
|
164
172
|
Returns:
|
|
165
|
-
The parsed block, or ``None`` when the manifest has no ``
|
|
173
|
+
The parsed block, or ``None`` when the manifest has no ``model_server`` key.
|
|
166
174
|
|
|
167
175
|
Raises:
|
|
168
|
-
ValueError: The block is not a mapping (an empty ``
|
|
169
|
-
names a key it does not take, or holds a value of the
|
|
170
|
-
range.
|
|
176
|
+
ValueError: The block is not a mapping (an empty ``model_server:``
|
|
177
|
+
included), names a key it does not take, or holds a value of the
|
|
178
|
+
wrong type or range.
|
|
171
179
|
"""
|
|
172
|
-
if "
|
|
180
|
+
if "model_server" not in runtime:
|
|
173
181
|
return None
|
|
174
|
-
block = runtime["
|
|
182
|
+
block = runtime["model_server"]
|
|
175
183
|
if not isinstance(block, dict):
|
|
176
184
|
raise ValueError(
|
|
177
|
-
f"runtime.
|
|
185
|
+
f"runtime.model_server must be a block with `import: module:Class`, got {block!r}"
|
|
178
186
|
)
|
|
179
187
|
if not isinstance(block.get("import"), str):
|
|
180
|
-
raise ValueError("runtime.
|
|
181
|
-
unknown = sorted(set(block) - set(
|
|
188
|
+
raise ValueError("runtime.model_server.import must name the model half as 'module:Class'")
|
|
189
|
+
unknown = sorted(set(block) - set(_MODEL_SERVER_KEYS))
|
|
182
190
|
if unknown:
|
|
183
191
|
raise ValueError(
|
|
184
|
-
f"runtime.
|
|
192
|
+
f"runtime.model_server has unknown keys {unknown}; "
|
|
193
|
+
f"it takes {', '.join(_MODEL_SERVER_KEYS)}"
|
|
185
194
|
)
|
|
186
|
-
return
|
|
195
|
+
return ModelServerConfig(**{_MODEL_SERVER_KEYS[key]: value for key, value in block.items()})
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
_SHARED_MEMORY = "model.resources.workers.shared_memory"
|
|
199
|
+
_SHARED_MEMORY_KEYS = {"input": "input_bytes", "output": "output_bytes"}
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
def _shared_memory_from_manifest(model: Any) -> SharedMemoryConfig:
|
|
203
|
+
"""Parse ``model.resources.workers.shared_memory`` into a :class:`SharedMemoryConfig`.
|
|
204
|
+
|
|
205
|
+
The block sizes the two shared-memory blocks of each worker of a split
|
|
206
|
+
model, as Kubernetes resource quantities (see :func:`_byte_quantity`)::
|
|
207
|
+
|
|
208
|
+
model:
|
|
209
|
+
resources:
|
|
210
|
+
workers:
|
|
211
|
+
shared_memory:
|
|
212
|
+
input: 1Mi
|
|
213
|
+
output: 24Mi
|
|
214
|
+
|
|
215
|
+
Only ``shared_memory`` is read. Every other key under ``model.resources``
|
|
216
|
+
and ``model.resources.workers`` sizes the deployment, not the runtime, and
|
|
217
|
+
is ignored, as is a ``resources`` or ``workers`` that is not a mapping.
|
|
218
|
+
Inside ``shared_memory`` an unknown key is refused: a misspelt size would
|
|
219
|
+
otherwise leave a worker's memory at its default without a word.
|
|
220
|
+
|
|
221
|
+
Args:
|
|
222
|
+
model: The raw ``model:`` value from the manifest, if any.
|
|
223
|
+
|
|
224
|
+
Returns:
|
|
225
|
+
The declared sizes, with :data:`~reactor_runtime.core.DEFAULT_SHM_INPUT_BYTES`
|
|
226
|
+
and :data:`~reactor_runtime.core.DEFAULT_SHM_OUTPUT_BYTES` for what the
|
|
227
|
+
block leaves out or when there is no block.
|
|
228
|
+
|
|
229
|
+
Raises:
|
|
230
|
+
ValueError: ``shared_memory`` is not a mapping (an empty
|
|
231
|
+
``shared_memory:`` included), names a key other than ``input`` and
|
|
232
|
+
``output``, or holds a size that is not a quantity of whole bytes,
|
|
233
|
+
at least 1.
|
|
234
|
+
"""
|
|
235
|
+
resources = model.get("resources") if isinstance(model, dict) else None
|
|
236
|
+
workers = resources.get("workers") if isinstance(resources, dict) else None
|
|
237
|
+
if not isinstance(workers, dict) or "shared_memory" not in workers:
|
|
238
|
+
return SharedMemoryConfig()
|
|
239
|
+
block = workers["shared_memory"]
|
|
240
|
+
if not isinstance(block, dict):
|
|
241
|
+
raise ValueError(
|
|
242
|
+
f"{_SHARED_MEMORY} must be a block with `input` and `output` sizes, got {block!r}"
|
|
243
|
+
)
|
|
244
|
+
unknown = sorted(set(block) - set(_SHARED_MEMORY_KEYS), key=str)
|
|
245
|
+
if unknown:
|
|
246
|
+
raise ValueError(
|
|
247
|
+
f"{_SHARED_MEMORY} has unknown keys {unknown}; it takes "
|
|
248
|
+
f"{', '.join(_SHARED_MEMORY_KEYS)}"
|
|
249
|
+
)
|
|
250
|
+
return SharedMemoryConfig(
|
|
251
|
+
**{
|
|
252
|
+
_SHARED_MEMORY_KEYS[key]: _byte_quantity(f"{_SHARED_MEMORY}.{key}", value)
|
|
253
|
+
for key, value in block.items()
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
_QUANTITY = re.compile(
|
|
259
|
+
r"(?P<number>[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+))"
|
|
260
|
+
r"(?:(?P<suffix>[KMGTPE]i|[numkMGTPE])|[eE](?P<exponent>[+-]?[0-9]+))?"
|
|
261
|
+
)
|
|
262
|
+
_SUFFIX_FACTORS: dict[str, Fraction] = {
|
|
263
|
+
"": Fraction(1),
|
|
264
|
+
**{f"{s}i": Fraction(2) ** (10 * (i + 1)) for i, s in enumerate("KMGTPE")},
|
|
265
|
+
**{s: Fraction(10) ** (3 * (i + 1)) for i, s in enumerate("kMGTPE")},
|
|
266
|
+
"m": Fraction(1, 10**3),
|
|
267
|
+
"u": Fraction(1, 10**6),
|
|
268
|
+
"n": Fraction(1, 10**9),
|
|
269
|
+
}
|
|
270
|
+
_MAX_BYTES = 2**63 - 1
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
def _byte_quantity(key: str, value: Any) -> int:
|
|
274
|
+
"""Read a size given as a Kubernetes resource quantity into a number of bytes.
|
|
275
|
+
|
|
276
|
+
A YAML integer is a number of bytes. A string is a quantity: a decimal
|
|
277
|
+
number, with an optional sign and fraction, then an optional suffix, binary
|
|
278
|
+
(``Ki Mi Gi Ti Pi Ei``), decimal (``n u m k M G T P E``), or a decimal
|
|
279
|
+
exponent (``e6``, ``E-3``). This is the grammar of Kubernetes'
|
|
280
|
+
``resource.ParseQuantity``. The value is computed exactly and must be a
|
|
281
|
+
whole number of bytes from 1 to ``2**63 - 1``: ``24Mi``, ``1.5Mi``,
|
|
282
|
+
``1e6``, ``1G`` and ``1048576`` are sizes; ``0``, ``-1Mi``, ``100m``,
|
|
283
|
+
``0.5``, ``1MiB`` and ``abc`` are not. A YAML float, such as an unquoted
|
|
284
|
+
``2.0``, is refused: a quantity with a fraction is written as a string.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
key: The manifest key the value sits under, for the error message.
|
|
288
|
+
value: The raw value from the manifest.
|
|
289
|
+
|
|
290
|
+
Returns:
|
|
291
|
+
The size in bytes.
|
|
292
|
+
|
|
293
|
+
Raises:
|
|
294
|
+
ValueError: The value is not a quantity of whole bytes, at least 1 and at
|
|
295
|
+
most ``2**63 - 1``, naming *key*.
|
|
296
|
+
"""
|
|
297
|
+
wrong = f"{key} must be a quantity of whole bytes, at least 1, such as 24Mi; got {value!r}"
|
|
298
|
+
too_large = f"{key} must be at most {_MAX_BYTES} bytes; got {value!r}"
|
|
299
|
+
if isinstance(value, float):
|
|
300
|
+
raise ValueError(
|
|
301
|
+
f"{wrong}, which YAML reads as a float: write the quantity as a string, such as '1.5Mi'"
|
|
302
|
+
)
|
|
303
|
+
if type(value) is int:
|
|
304
|
+
size = Fraction(value)
|
|
305
|
+
elif isinstance(value, str) and (match := _QUANTITY.fullmatch(value)):
|
|
306
|
+
number = Fraction(Decimal(match["number"]))
|
|
307
|
+
if match["exponent"] is None:
|
|
308
|
+
size = number * _SUFFIX_FACTORS[match["suffix"] or ""]
|
|
309
|
+
else:
|
|
310
|
+
exponent = int(match["exponent"])
|
|
311
|
+
# A number written in n characters lies within [10**-n, 10**n) when positive, so
|
|
312
|
+
# outside these exponents it is below 1 or above _MAX_BYTES (under 10**19). Settling
|
|
313
|
+
# those first keeps an exponent such as e999999999 from being computed.
|
|
314
|
+
digits = len(match["number"])
|
|
315
|
+
if exponent < -digits:
|
|
316
|
+
raise ValueError(wrong)
|
|
317
|
+
if exponent > digits + 19:
|
|
318
|
+
raise ValueError(too_large if number > 0 else wrong)
|
|
319
|
+
size = number * Fraction(10) ** exponent
|
|
320
|
+
else:
|
|
321
|
+
raise ValueError(wrong)
|
|
322
|
+
if size.denominator != 1 or size < 1:
|
|
323
|
+
raise ValueError(wrong)
|
|
324
|
+
if size > _MAX_BYTES:
|
|
325
|
+
raise ValueError(too_large)
|
|
326
|
+
return int(size)
|
|
187
327
|
|
|
188
328
|
|
|
189
329
|
def import_model_class(model_ref: str) -> type[ReactorCore]:
|