reactor-runtime 3.11.2__tar.gz → 3.11.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/PKG-INFO +1 -1
  2. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/pyproject.toml +1 -1
  3. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/pyproject.toml.orig +1 -1
  4. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/__init__.py +6 -0
  5. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/service.py +26 -0
  6. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/routes.py +13 -1
  7. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/manifest.py +71 -6
  8. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/batching.py +9 -2
  9. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/config.py +6 -3
  10. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/errors.py +12 -5
  11. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/process.py +1 -0
  12. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/server.py +67 -4
  13. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/server_core.py +329 -57
  14. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/runner.py +16 -2
  15. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/serve.py +24 -8
  16. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/connection.py +18 -5
  17. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/room.py +141 -9
  18. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/router.py +77 -2
  19. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/router.py +76 -2
  20. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/config.py +17 -2
  21. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/peer.py +23 -11
  22. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/LICENSE +0 -0
  23. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/NOTICE +0 -0
  24. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/README.md +0 -0
  25. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/__init__.py +0 -0
  26. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/codes.py +0 -0
  27. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/fields.py +0 -0
  28. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/model.py +0 -0
  29. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/naming.py +0 -0
  30. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/session.py +0 -0
  31. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/stages.py +0 -0
  32. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/stats.py +0 -0
  33. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/transport.py +0 -0
  34. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/typespec.py +0 -0
  35. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/core/values.py +0 -0
  36. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/__init__.py +0 -0
  37. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/errors.py +0 -0
  38. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/protocol.py +0 -0
  39. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/rank.py +0 -0
  40. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/runner.py +0 -0
  41. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/distributed/worker.py +0 -0
  42. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/environment.py +0 -0
  43. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/event_stream.py +0 -0
  44. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/__init__.py +0 -0
  45. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/events.py +0 -0
  46. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/server.py +0 -0
  47. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/spec.py +0 -0
  48. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/http/step_usage.py +0 -0
  49. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/__init__.py +0 -0
  50. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/app/__init__.py +0 -0
  51. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/app/input_state.py +0 -0
  52. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/app/outcome.py +0 -0
  53. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/app/reactor_app.py +0 -0
  54. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/app/step_completed.py +0 -0
  55. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/client.py +0 -0
  56. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/events/__init__.py +0 -0
  57. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/events/decorators.py +0 -0
  58. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/events/errors.py +0 -0
  59. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/events/messages.py +0 -0
  60. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/internal/__init__.py +0 -0
  61. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/internal/aliases.py +0 -0
  62. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/internal/bridge.py +0 -0
  63. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/internal/input_buffer.py +0 -0
  64. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/internal/reactor_core.py +0 -0
  65. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/model/__init__.py +0 -0
  66. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/model/contract.py +0 -0
  67. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/model/reactor_model.py +0 -0
  68. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/model/schema.py +0 -0
  69. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/pipeline/__init__.py +0 -0
  70. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/pipeline/idle.py +0 -0
  71. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/pipeline/input_state.py +0 -0
  72. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/pipeline/reactor_pipeline.py +0 -0
  73. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/tracks/__init__.py +0 -0
  74. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/tracks/descriptors.py +0 -0
  75. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/tracks/input.py +0 -0
  76. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/interface/tracks/output.py +0 -0
  77. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/ipc/__init__.py +0 -0
  78. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/ipc/blocks.py +0 -0
  79. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/ipc/payload.py +0 -0
  80. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/ipc/slot.py +0 -0
  81. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/log.py +0 -0
  82. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/message_gateway.py +0 -0
  83. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/metrics/__init__.py +0 -0
  84. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/metrics/command.py +0 -0
  85. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/metrics/model.py +0 -0
  86. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/metrics/registry.py +0 -0
  87. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/metrics/session.py +0 -0
  88. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/__init__.py +0 -0
  89. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/__main__.py +0 -0
  90. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/client.py +0 -0
  91. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/connection.py +0 -0
  92. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/link.py +0 -0
  93. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/protocol.py +0 -0
  94. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/model_server/shm_link.py +0 -0
  95. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/paths.py +0 -0
  96. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/__init__.py +0 -0
  97. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/base.py +0 -0
  98. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/common.py +0 -0
  99. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/frames.py +0 -0
  100. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/v0/__init__.py +0 -0
  101. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/v0/codec.py +0 -0
  102. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/v1/__init__.py +0 -0
  103. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/protocol/v1/codec.py +0 -0
  104. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/py.typed +0 -0
  105. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/recording/__init__.py +0 -0
  106. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/recording/chunk_encoder.py +0 -0
  107. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/recording/markers.py +0 -0
  108. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/recording/recorder.py +0 -0
  109. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/__init__.py +0 -0
  110. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/client_stats.py +0 -0
  111. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/connection_manager.py +0 -0
  112. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/offer_epochs.py +0 -0
  113. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/runtime_stats.py +0 -0
  114. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/session_start.py +0 -0
  115. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/stages.py +0 -0
  116. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/state_machine.py +0 -0
  117. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/system_client.py +0 -0
  118. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/runner/upload_resolution.py +0 -0
  119. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/schema.py +0 -0
  120. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/service.py +0 -0
  121. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/step_results/__init__.py +0 -0
  122. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/step_results/mp4.py +0 -0
  123. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/step_results/store.py +0 -0
  124. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/step_results/usage.py +0 -0
  125. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/__init__.py +0 -0
  126. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/acceptor.py +0 -0
  127. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/__init__.py +0 -0
  128. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/media_in.py +0 -0
  129. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/pacer.py +0 -0
  130. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/participant.py +0 -0
  131. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/signals.py +0 -0
  132. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/livekit/version.py +0 -0
  133. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/step_frames.py +0 -0
  134. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/__init__.py +0 -0
  135. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/acceptor.py +0 -0
  136. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/client_stats.py +0 -0
  137. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/connection.py +0 -0
  138. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/frame_stages.py +0 -0
  139. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/frames.py +0 -0
  140. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/message_stages.py +0 -0
  141. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/metrics.py +0 -0
  142. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/pacer.py +0 -0
  143. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/reading.py +0 -0
  144. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/router.py +0 -0
  145. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/sdp.py +0 -0
  146. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/signaling.py +0 -0
  147. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/stats.py +0 -0
  148. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/transport/webrtc/version.py +0 -0
  149. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_runtime/upload_store.py +0 -0
  150. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/common_pb2.py +0 -0
  151. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/common_pb2.pyi +0 -0
  152. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/control_pb2.py +0 -0
  153. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/control_pb2.pyi +0 -0
  154. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/data_pb2.py +0 -0
  155. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/data_pb2.pyi +0 -0
  156. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/model_pb2.py +0 -0
  157. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/model_pb2.pyi +0 -0
  158. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/platform_pb2.py +0 -0
  159. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/platform_pb2.pyi +0 -0
  160. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/step_pb2.py +0 -0
  161. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/step_pb2.pyi +0 -0
  162. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/src/reactor_wire/v1/track_pb2.py +0 -0
  163. {reactor_runtime-3.11.2 → reactor_runtime-3.11.4}/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.2
3
+ Version: 3.11.4
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>
@@ -107,7 +107,7 @@ pythonpath = [
107
107
 
108
108
  [project]
109
109
  name = "reactor-runtime"
110
- version = "3.11.2"
110
+ version = "3.11.4"
111
111
  description = "A Python framework for building real-time, interactive video models"
112
112
  readme = "README.md"
113
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.11.2"
23
+ version = "3.11.4"
24
24
  description = "A Python framework for building real-time, interactive video models"
25
25
  readme = "README.md"
26
26
  license = "Apache-2.0"
@@ -22,8 +22,11 @@ from reactor_runtime.core.model import (
22
22
  UploadedFile,
23
23
  )
24
24
  from reactor_runtime.core.service import (
25
+ DEFAULT_MAX_MESSAGE_BYTES,
25
26
  DEFAULT_SHM_INPUT_BYTES,
26
27
  DEFAULT_SHM_OUTPUT_BYTES,
28
+ MAX_MAX_MESSAGE_BYTES,
29
+ MIN_MAX_MESSAGE_BYTES,
27
30
  SHM_PAGE_BYTES,
28
31
  LiveKitBlockError,
29
32
  LiveKitConfig,
@@ -85,9 +88,12 @@ from reactor_runtime.core.values import (
85
88
  )
86
89
 
87
90
  __all__ = [
91
+ "DEFAULT_MAX_MESSAGE_BYTES",
88
92
  "DEFAULT_SHM_INPUT_BYTES",
89
93
  "DEFAULT_SHM_OUTPUT_BYTES",
90
94
  "JOURNAL_EVENTS",
95
+ "MAX_MAX_MESSAGE_BYTES",
96
+ "MIN_MAX_MESSAGE_BYTES",
91
97
  "SHM_PAGE_BYTES",
92
98
  "ClientConnected",
93
99
  "ClientConnectionStat",
@@ -228,6 +228,27 @@ sets it lower, since every worker's blocks are reserved up front.
228
228
  """
229
229
 
230
230
 
231
+ DEFAULT_MAX_MESSAGE_BYTES = 64 << 20
232
+ """The largest data-channel message a WebRTC connection carries when
233
+ ``runtime.webrtc.max_message_size`` sets none: 64 MiB.
234
+
235
+ A stepped session returns each step's result in one message, so this bounds the
236
+ media one step returns. A model whose steps are larger raises it in
237
+ ``reactor.yaml``.
238
+ """
239
+
240
+ MIN_MAX_MESSAGE_BYTES = 256 << 10
241
+ """The lowest ``runtime.webrtc.max_message_size``: 256 KiB, what a data channel
242
+ carries without chunking."""
243
+
244
+ MAX_MAX_MESSAGE_BYTES = 1 << 30
245
+ """The highest ``runtime.webrtc.max_message_size``: 1 GiB.
246
+
247
+ A step result is one protobuf message, which cannot reach 2 GiB, and the media
248
+ engine queues up to twice the limit on each channel.
249
+ """
250
+
251
+
231
252
  SHM_PAGE_BYTES = 64 << 10
232
253
  """The unit :func:`shm_slot_bytes` counts a block in: 64 KiB, a multiple of
233
254
  every common kernel page size (4, 16 and 64 KiB), so the bound is the same on
@@ -381,6 +402,10 @@ class RuntimeConfig:
381
402
  shared_memory: Each worker's shared-memory blocks for a split model,
382
403
  from ``model.resources.workers.shared_memory``; the defaults when
383
404
  the manifest sets none.
405
+ webrtc_max_message_size: The largest data-channel message, in bytes,
406
+ a WebRTC connection sends or accepts, from
407
+ ``runtime.webrtc.max_message_size``;
408
+ :data:`DEFAULT_MAX_MESSAGE_BYTES` when the manifest sets none.
384
409
  """
385
410
 
386
411
  model_ref: str
@@ -396,3 +421,4 @@ class RuntimeConfig:
396
421
  livekit: LiveKitConfig = field(default_factory=LiveKitConfig)
397
422
  model_server: ModelServerConfig | None = None
398
423
  shared_memory: SharedMemoryConfig = field(default_factory=SharedMemoryConfig)
424
+ webrtc_max_message_size: int = DEFAULT_MAX_MESSAGE_BYTES
@@ -548,7 +548,19 @@ class EgressRoutes:
548
548
  resume = since if since is not None else _resume_from(last_event_id)
549
549
  return StreamingResponse(_stream_events(runner, resume), media_type="text/event-stream")
550
550
 
551
- @app.get("/health", responses={503: {"description": "The process is unhealthy."}})
551
+ @app.get(
552
+ "/health",
553
+ responses={
554
+ 503: {
555
+ "description": (
556
+ "The process is unhealthy: a component reports it, such as the model, "
557
+ "the HTTP server, or a transport that keeps failing to release what its "
558
+ "connections held (LiveKit: a room connection stuck leaving its room while "
559
+ "the server answers others). `detail` says which."
560
+ )
561
+ }
562
+ },
563
+ )
552
564
  async def health(response: Response) -> HealthResponse:
553
565
  report = process_health()
554
566
  response.status_code = 503 if report.status is HealthStatus.UNHEALTHY else 200
@@ -6,7 +6,8 @@ The ``reactor.yaml`` manifest is the runtime's one configuration file:
6
6
  ``runtime.recording`` block configures the recorder, the
7
7
  ``runtime.step_results`` block says how each finished step is saved, the
8
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,
9
+ ``runtime.webrtc`` block sizes the largest message a WebRTC connection carries,
10
+ the ``runtime.model_server`` block names the model half of a model split in two,
10
11
  and ``model.resources.workers.shared_memory`` sizes the shared memory each of
11
12
  that model's workers exchanges with its model server. This module turns that
12
13
  file into a :class:`~reactor_runtime.core.RuntimeConfig` and the reference into
@@ -31,6 +32,9 @@ from typing import TYPE_CHECKING, Any
31
32
  import yaml
32
33
 
33
34
  from reactor_runtime.core import (
35
+ DEFAULT_MAX_MESSAGE_BYTES,
36
+ MAX_MAX_MESSAGE_BYTES,
37
+ MIN_MAX_MESSAGE_BYTES,
34
38
  LiveKitBlockError,
35
39
  LiveKitConfig,
36
40
  LiveKitRpcMethod,
@@ -57,7 +61,8 @@ def load_config(manifest: Path) -> RuntimeConfig:
57
61
  model, ``model.name`` is the name it is published under, the
58
62
  ``runtime.recording`` block configures the recorder, the
59
63
  ``runtime.step_results`` block configures step results, the
60
- ``runtime.livekit`` block configures room sessions, and the
64
+ ``runtime.livekit`` block configures room sessions, the ``runtime.webrtc``
65
+ block sizes WebRTC messages, and the
61
66
  ``runtime.model_server`` block with ``model.resources.workers.shared_memory``
62
67
  configures a model split in two; the rest of the manifest, the rest of
63
68
  ``model.resources`` included, describes the model to the platform and is
@@ -70,16 +75,18 @@ def load_config(manifest: Path) -> RuntimeConfig:
70
75
  Returns:
71
76
  A configuration naming the model the manifest points at, the name it
72
77
  publishes under, the path to its config file when present, the
73
- recorder's settings, the step-results settings, the room settings, and
74
- a split model's model server and shared-memory settings.
78
+ recorder's settings, the step-results settings, the room settings, the
79
+ largest WebRTC message, and a split model's model server and
80
+ shared-memory settings.
75
81
 
76
82
  Raises:
77
83
  SystemExit: If the manifest is not valid YAML, is not a mapping, or
78
84
  carries no ``runtime.import``.
79
85
  ValueError: If a block the runtime refuses to guess about has the
80
86
  wrong shape: a ``step_results.queue`` below 1, a malformed
81
- ``livekit`` block, a malformed ``model_server`` block, or a
82
- malformed ``model.resources.workers.shared_memory`` block.
87
+ ``livekit`` block, a malformed ``webrtc`` block, a malformed
88
+ ``model_server`` block, or a malformed
89
+ ``model.resources.workers.shared_memory`` block.
83
90
  """
84
91
  try:
85
92
  document = yaml.safe_load(manifest.read_text())
@@ -101,6 +108,7 @@ def load_config(manifest: Path) -> RuntimeConfig:
101
108
  livekit=_livekit_from_manifest(runtime),
102
109
  model_server=_model_server_from_manifest(runtime),
103
110
  shared_memory=_shared_memory_from_manifest(document.get("model")),
111
+ webrtc_max_message_size=_webrtc_max_message_size_from_manifest(runtime),
104
112
  )
105
113
 
106
114
 
@@ -255,6 +263,63 @@ def _shared_memory_from_manifest(model: Any) -> SharedMemoryConfig:
255
263
  )
256
264
 
257
265
 
266
+ _WEBRTC = "runtime.webrtc"
267
+ _WEBRTC_KEYS = ("max_message_size",)
268
+
269
+
270
+ def _webrtc_max_message_size_from_manifest(runtime: dict[str, Any]) -> int:
271
+ """Parse ``runtime.webrtc.max_message_size``, the largest WebRTC data-channel message.
272
+
273
+ The size is a Kubernetes resource quantity (see :func:`_byte_quantity`)::
274
+
275
+ runtime:
276
+ import: world:World
277
+ webrtc:
278
+ max_message_size: 256Mi
279
+
280
+ A stepped session returns each step's result in one data-channel message,
281
+ so a model whose steps return more media than the default 64 MiB raises it
282
+ here. The runtime declares the size to every client in its SDP answer, and
283
+ a connection carries the smaller of the two sides' limits: a client that
284
+ declares less still gets ``step_result_too_large`` for a larger step. The
285
+ limit holds in both directions and is process-wide, set on the media
286
+ engine. The engine may queue up to twice the limit, and at least 128 MiB,
287
+ on each data channel.
288
+
289
+ An unknown key is refused rather than ignored: a misspelt size would
290
+ otherwise leave the limit at its default without a word.
291
+
292
+ Args:
293
+ runtime: The manifest's ``runtime`` section.
294
+
295
+ Returns:
296
+ The size in bytes, or :data:`~reactor_runtime.core.DEFAULT_MAX_MESSAGE_BYTES`
297
+ when the manifest has no ``webrtc`` block or the block sets no size.
298
+
299
+ Raises:
300
+ ValueError: ``webrtc`` is not a mapping (an empty ``webrtc:``
301
+ included), names a key other than ``max_message_size``, or holds a
302
+ size that is not a quantity of whole bytes from 256Ki to 1Gi.
303
+ """
304
+ if "webrtc" not in runtime:
305
+ return DEFAULT_MAX_MESSAGE_BYTES
306
+ block = runtime["webrtc"]
307
+ if not isinstance(block, dict):
308
+ raise ValueError(f"{_WEBRTC} must be a block with `max_message_size`, got {block!r}")
309
+ unknown = sorted(set(block) - set(_WEBRTC_KEYS), key=str)
310
+ if unknown:
311
+ raise ValueError(
312
+ f"{_WEBRTC} has unknown keys {unknown}; it takes {', '.join(_WEBRTC_KEYS)}"
313
+ )
314
+ if "max_message_size" not in block:
315
+ return DEFAULT_MAX_MESSAGE_BYTES
316
+ key = f"{_WEBRTC}.max_message_size"
317
+ size = _byte_quantity(key, block["max_message_size"])
318
+ if not MIN_MAX_MESSAGE_BYTES <= size <= MAX_MAX_MESSAGE_BYTES:
319
+ raise ValueError(f"{key} must be from 256Ki to 1Gi; got {block['max_message_size']!r}")
320
+ return size
321
+
322
+
258
323
  _QUANTITY = re.compile(
259
324
  r"(?P<number>[+-]?(?:[0-9]+(?:\.[0-9]*)?|\.[0-9]+))"
260
325
  r"(?:(?P<suffix>[KMGTPE]i|[numkMGTPE])|[eE](?P<exponent>[+-]?[0-9]+))?"
@@ -63,7 +63,11 @@ class BatchPolicy:
63
63
  * Requests are taken in arrival order, up to ``max_batch`` at a time.
64
64
  * Once a request waits, the batch may wait up to ``batch_window`` seconds
65
65
  after it arrived for others, and is taken early once ``max_batch``
66
- requests wait or every open session has one waiting.
66
+ requests wait or every open session that can send one has one waiting.
67
+ A session whose request is running, its future included, cannot send
68
+ another, so it does not count. A model that schedules work across its
69
+ own stages, and returns futures, sets ``batch_window`` to 0 and is
70
+ stepped as soon as a request arrives.
67
71
  * A request whose deadline passed while it waited is expired, never stepped.
68
72
 
69
73
  Args:
@@ -116,6 +120,8 @@ class BatchPolicy:
116
120
  def take(self, now: float, open_sessions: int) -> Turn:
117
121
  """Decide what to step at *now*, given how many sessions are open.
118
122
 
123
+ Of the *open_sessions*, those whose request is running count as unable
124
+ to send, so a batch is full once every other one has a request waiting.
119
125
  The batch taken is removed from the queue, and its sessions stay busy
120
126
  until :meth:`finished`.
121
127
  """
@@ -127,7 +133,8 @@ class BatchPolicy:
127
133
  if not self._waiting:
128
134
  return Turn([], expired, None)
129
135
  first = self._waiting[0]
130
- full = len(self._waiting) >= min(self._max_batch, max(open_sessions, 1))
136
+ running = len(self._busy) - len({r.connection for r in self._waiting})
137
+ full = len(self._waiting) >= min(self._max_batch, max(open_sessions - running, 1))
131
138
  until = first.arrived + self._window
132
139
  if not full and now < until:
133
140
  deadlines = [r.deadline for r in self._waiting if r.deadline is not None]
@@ -142,6 +142,8 @@ STUCK_ENV = "REACTOR_MODEL_SERVER_STUCK_SECONDS"
142
142
  DEFAULT_SOCKET = "/run/reactor-model-server/sock"
143
143
  DEFAULT_HEALTH_PORT = 8090
144
144
  DEFAULT_STUCK_SECONDS = 120.0
145
+ DEFAULT_GRACE_SECONDS = 30.0
146
+ """Seconds a draining model server gives its running requests; ``SIGTERM_GRACE_PERIOD`` sets it."""
145
147
 
146
148
 
147
149
  @dataclass(frozen=True)
@@ -158,7 +160,8 @@ class ServerProcessConfig:
158
160
  stuck_after: Seconds one step may run before ``/health`` reports the
159
161
  model server stuck.
160
162
  exit_timeout: Seconds the orderly shutdown may take.
161
- grace_period: Seconds a draining step is given to finish.
163
+ grace_period: Seconds a draining model server gives its running
164
+ requests, futures included, before it fails the ones left.
162
165
  """
163
166
 
164
167
  socket: str
@@ -168,7 +171,7 @@ class ServerProcessConfig:
168
171
  health_port: int = DEFAULT_HEALTH_PORT
169
172
  stuck_after: float = DEFAULT_STUCK_SECONDS
170
173
  exit_timeout: float = 10.0
171
- grace_period: float = 30.0
174
+ grace_period: float = DEFAULT_GRACE_SECONDS
172
175
 
173
176
 
174
177
  def server_process_config() -> ServerProcessConfig:
@@ -205,5 +208,5 @@ def server_process_config() -> ServerProcessConfig:
205
208
  health_port=int_env(HEALTH_PORT_ENV, DEFAULT_HEALTH_PORT),
206
209
  stuck_after=stuck_after,
207
210
  exit_timeout=duration_env("EXIT_TIMEOUT_SECONDS", 10.0),
208
- grace_period=duration_env("SIGTERM_GRACE_PERIOD", 30.0),
211
+ grace_period=duration_env("SIGTERM_GRACE_PERIOD", DEFAULT_GRACE_SECONDS),
209
212
  )
@@ -95,16 +95,23 @@ class StepUnanswered(TimeoutError): # noqa: N818 (named for the event a caller
95
95
 
96
96
 
97
97
  class StepExpired(StepUnanswered):
98
- """The model server dropped the request unstepped: its timeout passed in the queue."""
98
+ """The model server answered the request without a result.
99
+
100
+ Its timeout passed while it waited in the queue, so it was never stepped,
101
+ or while the model ran it, or its session reset. A request the model was
102
+ running still keeps the session's one request until the model finishes
103
+ it, so a step sent meanwhile is refused with :class:`StepStillRunning`.
104
+ """
99
105
 
100
106
 
101
107
  class StepTimedOut(StepUnanswered):
102
108
  """No answer came within the step's timeout; the request was cancelled.
103
109
 
104
- A cancel withdraws a request still waiting in the model server's queue. A
105
- step the model is already running cannot be withdrawn: it keeps the
106
- session's one request until it ends, and a step sent meanwhile is refused
107
- with :class:`StepStillRunning`. The model server is slow or stuck; a model
110
+ A cancel withdraws a request still waiting in the model server's queue,
111
+ and tells the model to skip one whose work has not started. A step the
112
+ model is already running keeps the session's one request until it ends,
113
+ and a step sent meanwhile is refused with :class:`StepStillRunning`. The
114
+ model server is slow or stuck; a model
108
115
  server that stays stuck reports itself unhealthy, and its deployment
109
116
  restarts it.
110
117
  """
@@ -137,6 +137,7 @@ class ModelServerProcess:
137
137
  settings=settings,
138
138
  max_sessions=self._process.max_sessions,
139
139
  stuck_after=self._process.stuck_after,
140
+ drain_timeout=self._process.grace_period,
140
141
  )
141
142
  try:
142
143
  await self._server.start()
@@ -16,6 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  import math
18
18
  from collections.abc import Sequence
19
+ from concurrent.futures import Future
19
20
  from dataclasses import dataclass
20
21
  from pathlib import Path
21
22
  from typing import Any, ClassVar
@@ -90,6 +91,30 @@ class ModelServer[RequestT, ResultT]:
90
91
  joins the next step, never the running one.
91
92
  * A request whose timeout passed while it waited is answered as expired and
92
93
  never reaches ``step()``.
94
+ * A request whose output is a :class:`concurrent.futures.Future` keeps
95
+ running after ``step()`` returns, while other sessions' requests are
96
+ stepped, and its session stays busy until the future is done. See
97
+ :meth:`step`.
98
+
99
+ A pipeline hands each request to its first stage and returns a future
100
+ that its last stage completes::
101
+
102
+ def step(self, requests):
103
+ futures = []
104
+ for request in requests:
105
+ future = Future()
106
+ future.set_running_or_notify_cancel() # its work starts now
107
+ self.pipeline.submit(request, future)
108
+ futures.append(future)
109
+ return futures
110
+
111
+ # on the pipeline's last stage, once per request
112
+ future.set_result(frame) # or future.set_exception(error)
113
+
114
+ def session_closed(self, slot, generation):
115
+ # Stop that generation's work and wait for any stage still
116
+ # writing the slot's state, then resolve its futures.
117
+ self.pipeline.discard(slot, generation)
93
118
 
94
119
  What crosses between the halves is pickled, so a request, a result and a
95
120
  signal can be any value pickle takes. Plain data, such as frozen
@@ -147,7 +172,9 @@ class ModelServer[RequestT, ResultT]:
147
172
  A raise here fails the model server's start, and its process exits.
148
173
  """
149
174
 
150
- def step(self, requests: list[ServerRequest[RequestT]]) -> Sequence[ResultT | Exception]:
175
+ def step(
176
+ self, requests: list[ServerRequest[RequestT]]
177
+ ) -> Sequence[ResultT | Exception | Future[ResultT]]:
151
178
  """Run one step for every request and return one output per request, in order.
152
179
 
153
180
  An output that is an exception instance fails that request alone, and
@@ -158,7 +185,37 @@ class ModelServer[RequestT, ResultT]:
158
185
  sees a :class:`~reactor_runtime.model_server.BatchFailed` carrying the
159
186
  error, and its application decides what to do. Nothing is stepped
160
187
  again, and the model server goes on serving; :meth:`health` says
161
- whether it can.
188
+ whether it can. Requests whose futures earlier steps returned are not
189
+ part of the batch, and keep running.
190
+
191
+ An output that is a :class:`concurrent.futures.Future` completes its
192
+ request later, from any thread, as a stdlib executor completes one:
193
+
194
+ * Call ``set_running_or_notify_cancel()`` when the request's work
195
+ starts, before anything it does is visible, and skip the work if it
196
+ returns ``False``. Then call ``set_result()`` or ``set_exception()``
197
+ exactly once. An exception fails that request alone, as an
198
+ exception output does.
199
+ * The model server cancels the future when the request's timeout
200
+ passes, when its session gives up on it, resets or leaves, and when
201
+ the model server stops. ``cancel()`` only reaches work that has not
202
+ started: once running, the work goes on, and its result is dropped
203
+ if the session no longer waits for it. ``set_result()`` on a future
204
+ cancelled before it ran raises ``InvalidStateError``, which is why
205
+ the work starts with ``set_running_or_notify_cancel()``.
206
+ * Until the future is done, its session stays busy: a step it sends is
207
+ answered with :class:`~reactor_runtime.model_server.StepStillRunning`,
208
+ even after the request's timeout passed and the session got
209
+ :class:`~reactor_runtime.model_server.StepExpired`, so the model
210
+ never has two requests of one session running. A reset or a leave
211
+ frees the session at once instead, and :meth:`session_closed` keeps
212
+ the closed generation's work away from the next one's state.
213
+ * Every future must be done eventually, its session closed or not: one
214
+ that is not done ``stuck_after`` seconds after ``step()`` returned it
215
+ makes the model server report itself unhealthy, so a pipeline that
216
+ stops making progress is restarted.
217
+ * The future's done-callbacks run on the thread that completes it,
218
+ and are short: they finish the request and queue its answer.
162
219
 
163
220
  Args:
164
221
  requests: Between one and the effective ``max_batch`` requests, at
@@ -166,7 +223,7 @@ class ModelServer[RequestT, ResultT]:
166
223
 
167
224
  Returns:
168
225
  One output per request, in the order of *requests*: its result,
169
- or an exception.
226
+ an exception, or a future that resolves to one of them.
170
227
  """
171
228
  raise NotImplementedError(f"{type(self).__name__} must define step()")
172
229
 
@@ -181,8 +238,14 @@ class ModelServer[RequestT, ResultT]:
181
238
  """Drop the state of the session that held *slot*.
182
239
 
183
240
  Runs when the session runtime disconnects or dies, and before a reset
184
- reopens the slot; for any slot it runs before the next
241
+ reopens the slot. For any slot it runs before the next
185
242
  :meth:`session_opened`. A raise is logged and ignored.
243
+
244
+ A model that returns futures stops this generation's work here: work
245
+ that already started is out of ``cancel()``'s reach (see :meth:`step`),
246
+ so return only once no thread will write state the next session on
247
+ *slot* uses, and resolve the generation's futures, whose results the
248
+ model server drops. Its time counts toward ``stuck_after``.
186
249
  """
187
250
 
188
251
  def signal(self, slot: int, signal: Any) -> None: