reactor-runtime 3.10.2__tar.gz → 3.11.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.
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/PKG-INFO +4 -4
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/README.md +3 -3
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/pyproject.toml +3 -2
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/pyproject.toml.orig +3 -2
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/__init__.py +10 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/service.py +115 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/__init__.py +5 -8
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/errors.py +0 -9
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/protocol.py +1 -1
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/rank.py +48 -5
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/runner.py +1 -8
- reactor_runtime-3.11.0/src/reactor_runtime/environment.py +67 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/__init__.py +2 -1
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/server.py +98 -43
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/internal/reactor_core.py +83 -8
- reactor_runtime-3.11.0/src/reactor_runtime/ipc/__init__.py +44 -0
- reactor_runtime-3.11.0/src/reactor_runtime/ipc/blocks.py +246 -0
- reactor_runtime-3.11.0/src/reactor_runtime/ipc/payload.py +93 -0
- reactor_runtime-3.11.0/src/reactor_runtime/ipc/slot.py +219 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/log.py +27 -1
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/manifest.py +81 -4
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/__init__.py +82 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/__main__.py +60 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/batching.py +137 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/client.py +469 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/config.py +205 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/connection.py +163 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/errors.py +128 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/link.py +246 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/process.py +233 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/protocol.py +351 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/server.py +292 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/shm_link.py +783 -0
- reactor_runtime-3.11.0/src/reactor_runtime/model_server/worker.py +706 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/runner.py +3 -19
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/serve.py +13 -73
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/service.py +37 -2
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/media_in.py +22 -53
- reactor_runtime-3.10.2/src/reactor_runtime/distributed/ipc.py +0 -227
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/LICENSE +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/NOTICE +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/codes.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/fields.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/model.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/naming.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/session.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/stages.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/stats.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/transport.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/typespec.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/core/values.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/worker.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/event_stream.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/events.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/routes.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/spec.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/http/step_usage.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/app/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/app/input_state.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/app/outcome.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/app/reactor_app.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/app/step_completed.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/client.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/events/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/events/decorators.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/events/errors.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/events/messages.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/internal/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/internal/aliases.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/internal/bridge.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/internal/input_buffer.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/model/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/model/contract.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/model/reactor_model.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/model/schema.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/pipeline/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/pipeline/idle.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/pipeline/input_state.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/pipeline/reactor_pipeline.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/tracks/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/tracks/descriptors.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/tracks/input.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/interface/tracks/output.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/message_gateway.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/metrics/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/metrics/command.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/metrics/model.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/metrics/registry.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/metrics/session.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/paths.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/base.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/common.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/frames.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/v0/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/v0/codec.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/v1/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/protocol/v1/codec.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/py.typed +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/recording/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/recording/chunk_encoder.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/recording/markers.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/recording/recorder.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/client_stats.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/connection_manager.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/offer_epochs.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/runtime_stats.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/session_start.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/stages.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/state_machine.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/system_client.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/runner/upload_resolution.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/schema.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/step_results/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/step_results/mp4.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/step_results/store.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/step_results/usage.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/acceptor.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/connection.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/pacer.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/participant.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/room.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/router.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/signals.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/livekit/version.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/router.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/step_frames.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/__init__.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/acceptor.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/client_stats.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/config.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/connection.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/frame_stages.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/frames.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/message_stages.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/metrics.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/pacer.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/peer.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/reading.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/router.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/sdp.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/signaling.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/stats.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/transport/webrtc/version.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/upload_store.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/common_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/common_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/control_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/control_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/data_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/data_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/model_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/model_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/platform_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/platform_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/step_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/step_pb2.pyi +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_wire/v1/track_pb2.py +0 -0
- {reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/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.
|
|
3
|
+
Version: 3.11.0
|
|
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>
|
|
@@ -49,6 +49,7 @@ Reactor Runtime turns an inference pipeline into a real-time, interactive media
|
|
|
49
49
|
- 🏠 **LiveKit rooms.** A session can join a LiveKit room: the model's tracks are published there, and every other participant in the room is a client.
|
|
50
50
|
- ✅ **Typed, validated commands.** Declare the commands your model accepts with standard Python types and constraints. The runtime validates every payload before your handler runs and compiles the surface into an OpenAPI schema that drives typed client SDKs.
|
|
51
51
|
- 🗂️ **Step results.** Start a session with its input and a number of steps, and keep each step's output as a folder of files.
|
|
52
|
+
- 🧩 **Many sessions, one copy of the weights.** Split a model into a model half that one model server process loads once and an application half each session runtime runs, and every session shares its weights and GPU.
|
|
52
53
|
- 🔎 **Traceable logs.** `get_logger()` writes structured records, and every record a session writes carries its id, so one filter recovers a whole run.
|
|
53
54
|
- 📦 **One container, anywhere.** The `reactor` CLI scaffolds a workspace, builds a small image, and runs it locally. The same image deploys to [Reactor](https://reactor.inc)'s GPU cloud unchanged.
|
|
54
55
|
|
|
@@ -127,7 +128,7 @@ runtime:
|
|
|
127
128
|
|
|
128
129
|
A step's tracks are saved as one `output.mp4`, with a `result.json` that lists the step's files, and `GET /sessions/{id}/steps` serves the folders.
|
|
129
130
|
|
|
130
|
-
A session can also be stepped: `POST /start_session` with `"generation": "stepped"` runs one step per `RequestStep` a client sends on the data channel instead of streaming, and answers each request with a `StepResult` that carries the step's media, so a stepped client must negotiate data-channel chunking. The model code is the same in both modes; a model that overrides `run()` or `submit_command()` cannot be stepped.
|
|
131
|
+
A session can also be stepped: `POST /start_session` with `"generation": "stepped"` runs one step per `RequestStep` a client sends on the data channel instead of streaming, and answers each request with a `StepResult` that carries the step's media, so a stepped client must negotiate data-channel chunking. The model code is the same in both modes; a model that overrides `run()` or `submit_command()` cannot be stepped. Every example serves both; the [echo example](./examples/echo/README.md#stepped-session) shows a stepped session end to end.
|
|
131
132
|
|
|
132
133
|
A session can join a LiveKit room. The room connection publishes the model's output tracks, and every other participant in the room is a client of the session. The model's `reactor.yaml` says which RPC methods, data topics, and byte streams reach which of its commands, messages, and input tracks:
|
|
133
134
|
|
|
@@ -192,9 +193,8 @@ Not on macOS, or pinning a release in CI? See [Install the CLI](https://docs.rea
|
|
|
192
193
|
- [Events and messages](https://docs.reactor.inc/deploy/development/reactor-app/events-and-messages): commands, refusals with `CommandError`, and messages to clients
|
|
193
194
|
- [Video and audio tracks](https://docs.reactor.inc/deploy/development/reactor-app/video-and-audio-tracks): output and input tracks, and how input is buffered
|
|
194
195
|
- [Starter example](./examples/starter/README.md): the model `reactor init` scaffolds: one class, `generate()` alone, the smallest complete `ReactorApp`
|
|
195
|
-
- [Echo example](./examples/echo/README.md): the client's webcam and microphone in, an effect applied, both sent back, in batches
|
|
196
|
+
- [Echo example](./examples/echo/README.md): the client's webcam and microphone in, an effect applied, both sent back, in batches, streamed or one step per request
|
|
196
197
|
- [Waypoint example](./examples/waypoint/README.md): a world model on a GPU, seeded from an upload and steered live
|
|
197
|
-
- [Stepped echo example](./examples/stepped_echo/README.md): one frame and a JSON report back for every step, the reference for a stepped session
|
|
198
198
|
|
|
199
199
|
## Development
|
|
200
200
|
|
|
@@ -20,6 +20,7 @@ Reactor Runtime turns an inference pipeline into a real-time, interactive media
|
|
|
20
20
|
- 🏠 **LiveKit rooms.** A session can join a LiveKit room: the model's tracks are published there, and every other participant in the room is a client.
|
|
21
21
|
- ✅ **Typed, validated commands.** Declare the commands your model accepts with standard Python types and constraints. The runtime validates every payload before your handler runs and compiles the surface into an OpenAPI schema that drives typed client SDKs.
|
|
22
22
|
- 🗂️ **Step results.** Start a session with its input and a number of steps, and keep each step's output as a folder of files.
|
|
23
|
+
- 🧩 **Many sessions, one copy of the weights.** Split a model into a model half that one model server process loads once and an application half each session runtime runs, and every session shares its weights and GPU.
|
|
23
24
|
- 🔎 **Traceable logs.** `get_logger()` writes structured records, and every record a session writes carries its id, so one filter recovers a whole run.
|
|
24
25
|
- 📦 **One container, anywhere.** The `reactor` CLI scaffolds a workspace, builds a small image, and runs it locally. The same image deploys to [Reactor](https://reactor.inc)'s GPU cloud unchanged.
|
|
25
26
|
|
|
@@ -98,7 +99,7 @@ runtime:
|
|
|
98
99
|
|
|
99
100
|
A step's tracks are saved as one `output.mp4`, with a `result.json` that lists the step's files, and `GET /sessions/{id}/steps` serves the folders.
|
|
100
101
|
|
|
101
|
-
A session can also be stepped: `POST /start_session` with `"generation": "stepped"` runs one step per `RequestStep` a client sends on the data channel instead of streaming, and answers each request with a `StepResult` that carries the step's media, so a stepped client must negotiate data-channel chunking. The model code is the same in both modes; a model that overrides `run()` or `submit_command()` cannot be stepped.
|
|
102
|
+
A session can also be stepped: `POST /start_session` with `"generation": "stepped"` runs one step per `RequestStep` a client sends on the data channel instead of streaming, and answers each request with a `StepResult` that carries the step's media, so a stepped client must negotiate data-channel chunking. The model code is the same in both modes; a model that overrides `run()` or `submit_command()` cannot be stepped. Every example serves both; the [echo example](./examples/echo/README.md#stepped-session) shows a stepped session end to end.
|
|
102
103
|
|
|
103
104
|
A session can join a LiveKit room. The room connection publishes the model's output tracks, and every other participant in the room is a client of the session. The model's `reactor.yaml` says which RPC methods, data topics, and byte streams reach which of its commands, messages, and input tracks:
|
|
104
105
|
|
|
@@ -163,9 +164,8 @@ Not on macOS, or pinning a release in CI? See [Install the CLI](https://docs.rea
|
|
|
163
164
|
- [Events and messages](https://docs.reactor.inc/deploy/development/reactor-app/events-and-messages): commands, refusals with `CommandError`, and messages to clients
|
|
164
165
|
- [Video and audio tracks](https://docs.reactor.inc/deploy/development/reactor-app/video-and-audio-tracks): output and input tracks, and how input is buffered
|
|
165
166
|
- [Starter example](./examples/starter/README.md): the model `reactor init` scaffolds: one class, `generate()` alone, the smallest complete `ReactorApp`
|
|
166
|
-
- [Echo example](./examples/echo/README.md): the client's webcam and microphone in, an effect applied, both sent back, in batches
|
|
167
|
+
- [Echo example](./examples/echo/README.md): the client's webcam and microphone in, an effect applied, both sent back, in batches, streamed or one step per request
|
|
167
168
|
- [Waypoint example](./examples/waypoint/README.md): a world model on a GPU, seeded from an upload and steered live
|
|
168
|
-
- [Stepped echo example](./examples/stepped_echo/README.md): one frame and a JSON report back for every step, the reference for a stepped session
|
|
169
169
|
|
|
170
170
|
## Development
|
|
171
171
|
|
|
@@ -74,11 +74,12 @@ extra-paths = [
|
|
|
74
74
|
"examples/starter",
|
|
75
75
|
"examples/echo",
|
|
76
76
|
"examples/waypoint",
|
|
77
|
-
"
|
|
77
|
+
"tests/integration/pod/split_echo",
|
|
78
78
|
"tests/unit/transport/webrtc",
|
|
79
79
|
"tests/contract",
|
|
80
80
|
"endurance-tests",
|
|
81
81
|
"endurance-tests/model",
|
|
82
|
+
"endurance-tests/model-shared-worker",
|
|
82
83
|
]
|
|
83
84
|
|
|
84
85
|
[tool.ty.src]
|
|
@@ -106,7 +107,7 @@ pythonpath = [
|
|
|
106
107
|
|
|
107
108
|
[project]
|
|
108
109
|
name = "reactor-runtime"
|
|
109
|
-
version = "3.
|
|
110
|
+
version = "3.11.0"
|
|
110
111
|
description = "A Python framework for building real-time, interactive video models"
|
|
111
112
|
readme = "README.md"
|
|
112
113
|
license = "Apache-2.0"
|
|
@@ -20,7 +20,7 @@ version = "1.20261024.19"
|
|
|
20
20
|
|
|
21
21
|
[project]
|
|
22
22
|
name = "reactor-runtime"
|
|
23
|
-
version = "3.
|
|
23
|
+
version = "3.11.0"
|
|
24
24
|
description = "A Python framework for building real-time, interactive video models"
|
|
25
25
|
readme = "README.md"
|
|
26
26
|
license = "Apache-2.0"
|
|
@@ -150,11 +150,12 @@ extra-paths = [
|
|
|
150
150
|
"examples/starter",
|
|
151
151
|
"examples/echo",
|
|
152
152
|
"examples/waypoint",
|
|
153
|
-
"
|
|
153
|
+
"tests/integration/pod/split_echo",
|
|
154
154
|
"tests/unit/transport/webrtc",
|
|
155
155
|
"tests/contract",
|
|
156
156
|
"endurance-tests",
|
|
157
157
|
"endurance-tests/model",
|
|
158
|
+
"endurance-tests/model-shared-worker",
|
|
158
159
|
]
|
|
159
160
|
|
|
160
161
|
[tool.ty.src]
|
|
@@ -22,6 +22,9 @@ from reactor_runtime.core.model import (
|
|
|
22
22
|
UploadedFile,
|
|
23
23
|
)
|
|
24
24
|
from reactor_runtime.core.service import (
|
|
25
|
+
DEFAULT_SHM_INPUT_BYTES,
|
|
26
|
+
DEFAULT_SHM_OUTPUT_BYTES,
|
|
27
|
+
SHM_PAGE_BYTES,
|
|
25
28
|
LiveKitBlockError,
|
|
26
29
|
LiveKitConfig,
|
|
27
30
|
LiveKitRpcMethod,
|
|
@@ -29,6 +32,8 @@ from reactor_runtime.core.service import (
|
|
|
29
32
|
RuntimeConfig,
|
|
30
33
|
ServiceComponent,
|
|
31
34
|
StepResultsConfig,
|
|
35
|
+
WorkerConfig,
|
|
36
|
+
shm_slot_bytes,
|
|
32
37
|
)
|
|
33
38
|
from reactor_runtime.core.session import (
|
|
34
39
|
JOURNAL_EVENTS,
|
|
@@ -79,7 +84,10 @@ from reactor_runtime.core.values import (
|
|
|
79
84
|
)
|
|
80
85
|
|
|
81
86
|
__all__ = [
|
|
87
|
+
"DEFAULT_SHM_INPUT_BYTES",
|
|
88
|
+
"DEFAULT_SHM_OUTPUT_BYTES",
|
|
82
89
|
"JOURNAL_EVENTS",
|
|
90
|
+
"SHM_PAGE_BYTES",
|
|
83
91
|
"ClientConnected",
|
|
84
92
|
"ClientConnectionStat",
|
|
85
93
|
"ClientDisconnected",
|
|
@@ -142,4 +150,6 @@ __all__ = [
|
|
|
142
150
|
"TransportTrackReading",
|
|
143
151
|
"TypeSpec",
|
|
144
152
|
"UploadedFile",
|
|
153
|
+
"WorkerConfig",
|
|
154
|
+
"shm_slot_bytes",
|
|
145
155
|
]
|
|
@@ -214,6 +214,118 @@ class LiveKitConfig:
|
|
|
214
214
|
)
|
|
215
215
|
|
|
216
216
|
|
|
217
|
+
DEFAULT_SHM_INPUT_BYTES = 1 << 20
|
|
218
|
+
"""Each session's request block when the ``runtime.worker`` block names none: 1 MiB."""
|
|
219
|
+
|
|
220
|
+
DEFAULT_SHM_OUTPUT_BYTES = 32 << 20
|
|
221
|
+
"""Each session's output block when the ``runtime.worker`` block names none: 32 MiB.
|
|
222
|
+
|
|
223
|
+
Sized for a step that returns video. A model whose results are larger sets
|
|
224
|
+
``runtime.worker.shm_output_bytes``; one whose results are small sets it lower,
|
|
225
|
+
since every session's blocks are reserved up front.
|
|
226
|
+
"""
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
SHM_PAGE_BYTES = 64 << 10
|
|
230
|
+
"""The unit :func:`shm_slot_bytes` counts a block in: 64 KiB, a multiple of
|
|
231
|
+
every common kernel page size (4, 16 and 64 KiB), so the bound is the same on
|
|
232
|
+
whichever host computes it and never below what a memory-backed volume
|
|
233
|
+
charges."""
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def shm_slot_bytes(input_bytes: int, output_bytes: int) -> int:
|
|
237
|
+
"""Return the most shared memory one session's slot holds, which its volume must fit.
|
|
238
|
+
|
|
239
|
+
Two request blocks of *input_bytes*, the second only after a cancelled
|
|
240
|
+
request, and one output block of *output_bytes* (see
|
|
241
|
+
:mod:`reactor_runtime.model_server.shm_link`). Each block is counted in
|
|
242
|
+
whole :data:`SHM_PAGE_BYTES`. For sizes that are a multiple of 64 KiB, as
|
|
243
|
+
the defaults are, that is ``2 * input_bytes + output_bytes``.
|
|
244
|
+
"""
|
|
245
|
+
return 2 * _whole_pages(input_bytes) + _whole_pages(output_bytes)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def _whole_pages(size: int) -> int:
|
|
249
|
+
return -(-size // SHM_PAGE_BYTES) * SHM_PAGE_BYTES
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
@dataclass(frozen=True)
|
|
253
|
+
class WorkerConfig:
|
|
254
|
+
"""The model half of a model split in two, drawn from the manifest's ``runtime.worker`` block.
|
|
255
|
+
|
|
256
|
+
Read by the model server's entry point; a session runtime reads only that
|
|
257
|
+
the block exists. The shared-memory sizes are set here and nowhere else,
|
|
258
|
+
because a deployment sizes each session's memory from the manifest: what
|
|
259
|
+
the block declares is what a deployment gives the model.
|
|
260
|
+
|
|
261
|
+
Attributes:
|
|
262
|
+
import_ref: The model half, a ``ModelServer`` subclass, as ``"module:Class"``.
|
|
263
|
+
max_batch: The most requests one step receives; ``None`` keeps the
|
|
264
|
+
class's ``max_batch``, which this may only lower.
|
|
265
|
+
batch_window: Seconds the worker waits for a batch to fill; ``None``
|
|
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.
|
|
273
|
+
|
|
274
|
+
Raises:
|
|
275
|
+
ValueError: ``import`` is not ``"module:Class"`` with both parts, a size
|
|
276
|
+
or ``max_batch`` is not a positive integer, or ``batch_window`` is
|
|
277
|
+
not a finite number of seconds, at least 0.
|
|
278
|
+
"""
|
|
279
|
+
|
|
280
|
+
import_ref: str
|
|
281
|
+
max_batch: int | None = None
|
|
282
|
+
batch_window: float | None = None
|
|
283
|
+
shm_input_bytes: int | None = None
|
|
284
|
+
shm_output_bytes: int | None = None
|
|
285
|
+
|
|
286
|
+
def __post_init__(self) -> None:
|
|
287
|
+
"""Refuse a value of the wrong type or range, naming its key."""
|
|
288
|
+
module, separator, name = (
|
|
289
|
+
self.import_ref.partition(":") if isinstance(self.import_ref, str) else ("", "", "")
|
|
290
|
+
)
|
|
291
|
+
if not separator or not module or not name:
|
|
292
|
+
raise ValueError(
|
|
293
|
+
f"runtime.worker.import must name the model half as 'module:Class', "
|
|
294
|
+
f"got {self.import_ref!r}"
|
|
295
|
+
)
|
|
296
|
+
for key in ("max_batch", "shm_input_bytes", "shm_output_bytes"):
|
|
297
|
+
value = getattr(self, key)
|
|
298
|
+
if value is not None and (type(value) is not int or value < 1):
|
|
299
|
+
raise ValueError(f"runtime.worker.{key} must be a positive integer, got {value!r}")
|
|
300
|
+
window = self.batch_window
|
|
301
|
+
if window is not None and (
|
|
302
|
+
type(window) not in (int, float) or not 0 <= window < float("inf")
|
|
303
|
+
):
|
|
304
|
+
raise ValueError(
|
|
305
|
+
f"runtime.worker.batch_window must be a number of seconds, at least 0, "
|
|
306
|
+
f"got {window!r}"
|
|
307
|
+
)
|
|
308
|
+
|
|
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
|
+
|
|
217
329
|
@dataclass(frozen=True)
|
|
218
330
|
class RuntimeConfig:
|
|
219
331
|
"""The single configuration object threaded through ``serve``.
|
|
@@ -240,6 +352,8 @@ class RuntimeConfig:
|
|
|
240
352
|
recording: The recorder's configuration; disabled by default.
|
|
241
353
|
step_results: How each finished step is saved; disabled by default.
|
|
242
354
|
livekit: How a LiveKit room reaches the model; empty by default.
|
|
355
|
+
worker: The model half of a model split in two, from ``runtime.worker``;
|
|
356
|
+
``None`` for a model that does not split.
|
|
243
357
|
"""
|
|
244
358
|
|
|
245
359
|
model_ref: str
|
|
@@ -253,3 +367,4 @@ class RuntimeConfig:
|
|
|
253
367
|
recording: RecordingConfig = field(default_factory=RecordingConfig)
|
|
254
368
|
step_results: StepResultsConfig = field(default_factory=StepResultsConfig)
|
|
255
369
|
livekit: LiveKitConfig = field(default_factory=LiveKitConfig)
|
|
370
|
+
worker: WorkerConfig | None = None
|
{reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/__init__.py
RENAMED
|
@@ -11,18 +11,15 @@ shared-memory, or NCCL code::
|
|
|
11
11
|
runner.reset()
|
|
12
12
|
runner.shutdown()
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
Nothing else in the runtime depends on this package, and it reads no manifest
|
|
15
|
+
and no environment variable of its own. Its shared memory comes from
|
|
16
|
+
:mod:`reactor_runtime.ipc`.
|
|
16
17
|
"""
|
|
17
18
|
|
|
18
|
-
from reactor_runtime.distributed.errors import
|
|
19
|
-
RankDesync,
|
|
20
|
-
SharedSlotAllocationFailed,
|
|
21
|
-
WorkerCrashed,
|
|
22
|
-
WorkerTimeout,
|
|
23
|
-
)
|
|
19
|
+
from reactor_runtime.distributed.errors import RankDesync, WorkerCrashed, WorkerTimeout
|
|
24
20
|
from reactor_runtime.distributed.runner import DistributedRunner
|
|
25
21
|
from reactor_runtime.distributed.worker import DistributedWorker
|
|
22
|
+
from reactor_runtime.ipc import SharedSlotAllocationFailed
|
|
26
23
|
|
|
27
24
|
__all__ = [
|
|
28
25
|
"DistributedRunner",
|
|
@@ -32,12 +32,3 @@ class RankDesync(RuntimeError): # noqa: N818 (named for the state a caller catc
|
|
|
32
32
|
rank was meant to contribute to, so it is not returned. The group refuses
|
|
33
33
|
further calls.
|
|
34
34
|
"""
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class SharedSlotAllocationFailed(MemoryError): # noqa: N818 (named for the event a caller catches)
|
|
38
|
-
"""A shared-memory block could not be created or grown.
|
|
39
|
-
|
|
40
|
-
The message states the size that was asked for and, where the host exposes
|
|
41
|
-
it, the size of ``/dev/shm``. Docker's default is 64 MB; ``--shm-size`` on
|
|
42
|
-
``docker run`` and a ``medium: Memory`` ``emptyDir`` on a pod raise it.
|
|
43
|
-
"""
|
{reactor_runtime-3.10.2 → reactor_runtime-3.11.0}/src/reactor_runtime/distributed/protocol.py
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Requests go from the runner to every rank, in the same order on every rank's
|
|
4
4
|
queue. Every rank answers every request. A large payload never rides on a
|
|
5
5
|
queue: :class:`Generate` and :class:`Answer` carry a header from
|
|
6
|
-
:func:`~reactor_runtime.
|
|
6
|
+
:func:`~reactor_runtime.ipc.pack`, and the bytes sit in a shared
|
|
7
7
|
block the header names.
|
|
8
8
|
"""
|
|
9
9
|
|
|
@@ -21,7 +21,6 @@ import queue
|
|
|
21
21
|
import sys
|
|
22
22
|
from typing import Any
|
|
23
23
|
|
|
24
|
-
from reactor_runtime.distributed.ipc import SharedSlot, SlotReader, pack, unpack
|
|
25
24
|
from reactor_runtime.distributed.protocol import (
|
|
26
25
|
Answer,
|
|
27
26
|
Generate,
|
|
@@ -31,6 +30,7 @@ from reactor_runtime.distributed.protocol import (
|
|
|
31
30
|
Reset,
|
|
32
31
|
Shutdown,
|
|
33
32
|
)
|
|
33
|
+
from reactor_runtime.ipc import SharedSlot, SlotReader, pack, unpack
|
|
34
34
|
from reactor_runtime.log import configure as configure_logging
|
|
35
35
|
from reactor_runtime.log import get_logger
|
|
36
36
|
|
|
@@ -148,13 +148,56 @@ def portable(exc: Exception) -> Exception:
|
|
|
148
148
|
"""Return *exc* if it pickles, else a ``RuntimeError`` carrying its type and message.
|
|
149
149
|
|
|
150
150
|
The parent re-raises what a worker raised. An exception whose arguments do
|
|
151
|
-
not pickle would fail on the queue, so it is replaced by one that does.
|
|
151
|
+
not pickle would fail on the queue, so it is replaced by one that does. The
|
|
152
|
+
check uses the protocol the queue pickles with.
|
|
152
153
|
"""
|
|
154
|
+
return portable_pickle(exc, protocol=pickle.DEFAULT_PROTOCOL)[0]
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def portable_pickle[E: BaseException](
|
|
158
|
+
exc: E,
|
|
159
|
+
*,
|
|
160
|
+
protocol: int = 5,
|
|
161
|
+
limit: int | None = None,
|
|
162
|
+
description: str | None = None,
|
|
163
|
+
) -> tuple[E | RuntimeError, bytes]:
|
|
164
|
+
"""Return the exception to send in place of *exc*, and the exact bytes to send.
|
|
165
|
+
|
|
166
|
+
*exc* is kept when its pickle in *protocol* is rebuilt by a round trip and,
|
|
167
|
+
with *limit*, fits it; the bytes returned are that pickle, so what was
|
|
168
|
+
checked is what is sent. Otherwise a ``RuntimeError`` carrying
|
|
169
|
+
*description* stands in for it, with ``"(too large to send whole)"`` when
|
|
170
|
+
only the size failed. Never raises: an exception whose ``__str__`` raises
|
|
171
|
+
is described by its type alone.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
exc: The exception to carry.
|
|
175
|
+
protocol: The pickle protocol the bytes will travel in.
|
|
176
|
+
limit: The most bytes the pickle may take, or ``None`` for no bound.
|
|
177
|
+
description: The stand-in's message; ``"Type: message"`` of *exc*
|
|
178
|
+
when omitted.
|
|
179
|
+
"""
|
|
180
|
+
text = description if description is not None else f"{type(exc).__name__}: {_text(exc)}"
|
|
181
|
+
try:
|
|
182
|
+
blob = pickle.dumps(exc, protocol=protocol)
|
|
183
|
+
# Measured before the round trip: an exception too large to send is
|
|
184
|
+
# never unpickled, which is where its large state would cost the most.
|
|
185
|
+
if limit is not None and len(blob) > limit:
|
|
186
|
+
stand_in = RuntimeError(f"{text} (too large to send whole)")
|
|
187
|
+
return stand_in, pickle.dumps(stand_in, protocol=protocol)
|
|
188
|
+
pickle.loads(blob)
|
|
189
|
+
except Exception:
|
|
190
|
+
stand_in = RuntimeError(text)
|
|
191
|
+
else:
|
|
192
|
+
return exc, blob
|
|
193
|
+
return stand_in, pickle.dumps(stand_in, protocol=protocol)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _text(exc: BaseException) -> str:
|
|
153
197
|
try:
|
|
154
|
-
|
|
198
|
+
return str(exc)
|
|
155
199
|
except Exception:
|
|
156
|
-
return
|
|
157
|
-
return exc
|
|
200
|
+
return "<unprintable>"
|
|
158
201
|
|
|
159
202
|
|
|
160
203
|
def _generate(
|
|
@@ -26,14 +26,6 @@ import time
|
|
|
26
26
|
from typing import Any
|
|
27
27
|
|
|
28
28
|
from reactor_runtime.distributed.errors import RankDesync, WorkerCrashed, WorkerTimeout
|
|
29
|
-
from reactor_runtime.distributed.ipc import (
|
|
30
|
-
SharedSlot,
|
|
31
|
-
SlotReader,
|
|
32
|
-
new_prefix,
|
|
33
|
-
pack,
|
|
34
|
-
unlink_blocks,
|
|
35
|
-
unpack,
|
|
36
|
-
)
|
|
37
29
|
from reactor_runtime.distributed.protocol import (
|
|
38
30
|
Answer,
|
|
39
31
|
Generate,
|
|
@@ -45,6 +37,7 @@ from reactor_runtime.distributed.protocol import (
|
|
|
45
37
|
)
|
|
46
38
|
from reactor_runtime.distributed.rank import rank_main
|
|
47
39
|
from reactor_runtime.distributed.worker import check_shape
|
|
40
|
+
from reactor_runtime.ipc import SharedSlot, SlotReader, new_prefix, pack, unlink_blocks, unpack
|
|
48
41
|
from reactor_runtime.log import get_logger
|
|
49
42
|
|
|
50
43
|
logger = get_logger(__name__)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Read the runtime's settings from the environment: the helpers every entry point shares.
|
|
2
|
+
|
|
3
|
+
The runtime's entry points (``python -m reactor_runtime.serve`` and
|
|
4
|
+
``python -m reactor_runtime.model_server``) read the manifest for what the
|
|
5
|
+
model declares and the environment for what the deployment decides. These
|
|
6
|
+
helpers parse one variable each, with one rule for an unset value (the default)
|
|
7
|
+
and one for a malformed one (the process refuses to start, naming it).
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
import math
|
|
14
|
+
import os
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def float_env(name: str, default: float) -> float:
|
|
18
|
+
"""Return env var *name* as a float, or *default* when unset/empty.
|
|
19
|
+
|
|
20
|
+
Raises:
|
|
21
|
+
SystemExit: If the value is set but not a number.
|
|
22
|
+
"""
|
|
23
|
+
raw = os.getenv(name, "").strip()
|
|
24
|
+
if not raw:
|
|
25
|
+
return default
|
|
26
|
+
try:
|
|
27
|
+
return float(raw)
|
|
28
|
+
except ValueError:
|
|
29
|
+
raise SystemExit(f"{name} {raw!r} must be a number") from None
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def duration_env(name: str, default: float) -> float:
|
|
33
|
+
"""Return env var *name* as a finite, non-negative number of seconds.
|
|
34
|
+
|
|
35
|
+
For a window that arms a timer. ``float`` also parses ``inf`` and ``nan``,
|
|
36
|
+
which a timer cannot hold — an infinite deadline never fires and a NaN or
|
|
37
|
+
negative one fires at once — so those are refused at boot rather than
|
|
38
|
+
left to disable or trip the guarantee the window exists for.
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
SystemExit: If the value is set but not a finite number of at least zero.
|
|
42
|
+
"""
|
|
43
|
+
value = float_env(name, default)
|
|
44
|
+
if not math.isfinite(value) or value < 0:
|
|
45
|
+
raise SystemExit(f"{name} {os.getenv(name, '').strip()!r} must be a finite number >= 0")
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def int_env(name: str, default: int) -> int:
|
|
50
|
+
"""Return env var *name* as an int, or *default* when unset/empty.
|
|
51
|
+
|
|
52
|
+
Raises:
|
|
53
|
+
SystemExit: If the value is set but not an integer.
|
|
54
|
+
"""
|
|
55
|
+
raw = os.getenv(name, "").strip()
|
|
56
|
+
if not raw:
|
|
57
|
+
return default
|
|
58
|
+
try:
|
|
59
|
+
return int(raw)
|
|
60
|
+
except ValueError:
|
|
61
|
+
raise SystemExit(f"{name} {raw!r} must be an integer") from None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def log_level_from_env() -> int:
|
|
65
|
+
"""Resolve ``REACTOR_LOG_LEVEL`` to a logging level, defaulting to ``INFO``."""
|
|
66
|
+
name = os.getenv("REACTOR_LOG_LEVEL", "INFO").strip().upper()
|
|
67
|
+
return logging.getLevelNamesMapping().get(name, logging.INFO)
|
|
@@ -14,10 +14,11 @@ from reactor_runtime.http.routes import (
|
|
|
14
14
|
StepRoutes,
|
|
15
15
|
UploadRoutes,
|
|
16
16
|
)
|
|
17
|
-
from reactor_runtime.http.server import HttpServer
|
|
17
|
+
from reactor_runtime.http.server import HealthServer, HttpServer
|
|
18
18
|
|
|
19
19
|
__all__ = [
|
|
20
20
|
"EgressRoutes",
|
|
21
|
+
"HealthServer",
|
|
21
22
|
"HttpServer",
|
|
22
23
|
"RecordingRoutes",
|
|
23
24
|
"SessionRoutes",
|