Skip to content

Commit

Permalink
Debug why streamining hangs
Browse files Browse the repository at this point in the history
  • Loading branch information
marius-baseten committed Aug 28, 2024
1 parent 47cecfc commit 43db092
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "truss"
version = "0.9.30rc667"
version = "0.9.30rc668"
description = "A seamless bridge from model development to model delivery"
license = "MIT"
readme = "README.md"
Expand Down
6 changes: 4 additions & 2 deletions truss/templates/server/common/truss_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ async def predict(
model: ModelWrapper = self._safe_lookup_model(model_name)

self.check_healthy(model)
# TODO: warn (or skip tracing), if no parent info was found?
trace_ctx = otel_propagate.extract(request.headers)

print(f"############\n{request.headers}")

trace_ctx = otel_propagate.extract(request.headers) or None
# This is the top-level span in the truss-server, so we set the context here.
# Nested spans "inherit" context automatically.
with self._tracer.start_as_current_span(
Expand Down
4 changes: 2 additions & 2 deletions truss/templates/server/model_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def try_load(self):
retry(
self._model.load,
NUM_LOAD_RETRIES,
self._logger.warn,
self._logger.warning,
"Failed to load model.",
gap_seconds=1.0,
)
Expand Down Expand Up @@ -345,7 +345,7 @@ async def _stream_with_background_task(
self.write_response_to_queue(response_queue, async_generator, span)
)
# Defer the release of the semaphore until the write_response_to_queue task.
gen_task.add_done_callback(lambda _: release_and_end)
gen_task.add_done_callback(lambda _: release_and_end())

# The gap between responses in a stream must be < streaming_read_timeout
async def _response_generator():
Expand Down

0 comments on commit 43db092

Please sign in to comment.