truss 0.11.1rc10__py3-none-any.whl → 0.11.1rc12__py3-none-any.whl
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.
Potentially problematic release.
This version of truss might be problematic. Click here for more details.
- truss/templates/control/control/endpoints.py +22 -15
- truss/templates/control/requirements.txt +1 -1
- {truss-0.11.1rc10.dist-info → truss-0.11.1rc12.dist-info}/METADATA +1 -1
- {truss-0.11.1rc10.dist-info → truss-0.11.1rc12.dist-info}/RECORD +7 -7
- {truss-0.11.1rc10.dist-info → truss-0.11.1rc12.dist-info}/WHEEL +0 -0
- {truss-0.11.1rc10.dist-info → truss-0.11.1rc12.dist-info}/entry_points.txt +0 -0
- {truss-0.11.1rc10.dist-info → truss-0.11.1rc12.dist-info}/licenses/LICENSE +0 -0
|
@@ -11,8 +11,7 @@ from starlette.requests import ClientDisconnect, Request
|
|
|
11
11
|
from starlette.responses import Response
|
|
12
12
|
from starlette.websockets import WebSocketDisconnect as StartletteWebSocketDisconnect
|
|
13
13
|
from tenacity import RetryCallState, Retrying, retry_if_exception_type, wait_fixed
|
|
14
|
-
from wsproto.
|
|
15
|
-
from wsproto.events import BytesMessage, CloseConnection, TextMessage
|
|
14
|
+
from wsproto.events import BytesMessage, TextMessage
|
|
16
15
|
|
|
17
16
|
from truss.templates.control.control.helpers.errors import (
|
|
18
17
|
ModelLoadFailed,
|
|
@@ -158,19 +157,27 @@ async def forward_to_server(
|
|
|
158
157
|
|
|
159
158
|
async def forward_to_client(client_ws: WebSocket, server_ws: AsyncWebSocketSession):
|
|
160
159
|
while True:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
await
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
160
|
+
try:
|
|
161
|
+
message = await server_ws.receive()
|
|
162
|
+
if isinstance(message, TextMessage):
|
|
163
|
+
await client_ws.send_text(message.data)
|
|
164
|
+
elif isinstance(message, BytesMessage):
|
|
165
|
+
await client_ws.send_bytes(message.data)
|
|
166
|
+
except WebSocketDisconnect as e:
|
|
167
|
+
logger = client_ws.app.state.logger
|
|
168
|
+
logger.info(
|
|
169
|
+
f"PROXY: Received WebSocketDisconnect from server - Code: {e.code}, Reason: {e.reason}"
|
|
170
|
+
)
|
|
171
|
+
await _safe_close_ws(client_ws, logger, e.code or 1000, e.reason)
|
|
172
|
+
logger.info("PROXY: Client connection closed successfully")
|
|
173
|
+
return # Make sure to return!
|
|
174
|
+
except Exception as e:
|
|
175
|
+
logger = client_ws.app.state.logger
|
|
176
|
+
logger.error(
|
|
177
|
+
f"PROXY: Unexpected error in forward_to_client: {e}", exc_info=True
|
|
178
|
+
)
|
|
179
|
+
await _safe_close_ws(client_ws, logger, 1011, "Proxy error")
|
|
180
|
+
return # Make sure to return!
|
|
174
181
|
|
|
175
182
|
|
|
176
183
|
# NB(nikhil): _handle_websocket_forwarding uses some py311 specific syntax, but in newer
|
|
@@ -72,9 +72,9 @@ truss/templates/cache_requirements.txt,sha256=xoPoJ-OVnf1z6oq_RVM3vCr3ionByyqMLj
|
|
|
72
72
|
truss/templates/copy_cache_files.Dockerfile.jinja,sha256=Os5zFdYLZ_AfCRGq4RcpVTObOTwL7zvmwYcvOzd_Zqo,126
|
|
73
73
|
truss/templates/docker_server_requirements.txt,sha256=PyhOPKAmKW1N2vLvTfLMwsEtuGpoRrbWuNo7tT6v2Mc,18
|
|
74
74
|
truss/templates/server.Dockerfile.jinja,sha256=CUYnF_hgxPGq2re7__0UPWlwzOHMoFkxp6NVKi3U16s,7071
|
|
75
|
-
truss/templates/control/requirements.txt,sha256=
|
|
75
|
+
truss/templates/control/requirements.txt,sha256=MdbJzwV3HDCyd16QUMPxwOJ2nmwEYJcYenUN26TEVQ8,254
|
|
76
76
|
truss/templates/control/control/application.py,sha256=jYeta6hWe1SkfLL3W4IDmdYjg3ZuKqI_UagWYs5RB_E,3793
|
|
77
|
-
truss/templates/control/control/endpoints.py,sha256=
|
|
77
|
+
truss/templates/control/control/endpoints.py,sha256=ZAx5MRN67QiUEOiE0QvEGGjqTxBpCC-93rErrsKW8oY,12605
|
|
78
78
|
truss/templates/control/control/server.py,sha256=R4Y219i1dcz0kkksN8obLoX-YXWGo9iW1igindyG50c,3128
|
|
79
79
|
truss/templates/control/control/helpers/context_managers.py,sha256=W6dyFgLBhPa5meqrOb3w_phMtKfaJI-GhwUfpiycDc8,413
|
|
80
80
|
truss/templates/control/control/helpers/custom_types.py,sha256=n_lTudtLTpy4oPV3aDdJ4X2rh3KCV5btYO9UnTeUouQ,5471
|
|
@@ -367,8 +367,8 @@ truss_train/definitions.py,sha256=V985HhY4rdXL10DZxpFEpze9ScxzWErMht4WwaPknGU,67
|
|
|
367
367
|
truss_train/deployment.py,sha256=lWWANSuzBWu2M4oK4qD7n-oVR1JKdmw2Pn5BJQHg-Ck,3074
|
|
368
368
|
truss_train/loader.py,sha256=0o66EjBaHc2YY4syxxHVR4ordJWs13lNXnKjKq2wq0U,1630
|
|
369
369
|
truss_train/public_api.py,sha256=9N_NstiUlmBuLUwH_fNG_1x7OhGCytZLNvqKXBlStrM,1220
|
|
370
|
-
truss-0.11.
|
|
371
|
-
truss-0.11.
|
|
372
|
-
truss-0.11.
|
|
373
|
-
truss-0.11.
|
|
374
|
-
truss-0.11.
|
|
370
|
+
truss-0.11.1rc12.dist-info/METADATA,sha256=xHaxci-7BxoXvZUdBJbZMDdRvgP4n7-nMIFjy5lpTJ8,6673
|
|
371
|
+
truss-0.11.1rc12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
372
|
+
truss-0.11.1rc12.dist-info/entry_points.txt,sha256=-MwKfHHQHQ6j0HqIgvxrz3CehCmczDLTD-OsRHnjjuU,130
|
|
373
|
+
truss-0.11.1rc12.dist-info/licenses/LICENSE,sha256=FTqGzu85i-uw1Gi8E_o0oD60bH9yQ_XIGtZbA1QUYiw,1064
|
|
374
|
+
truss-0.11.1rc12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|