Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CONTAINER_RUNTIME ?= $(shell command -v podman 2>/dev/null || command -v docker
docs/models/database.svg

run-stack: ## Run lightspeed-stack directly, without building dependent service/s
uv run src/lightspeed_stack.py -c $(CONFIG)
uv run opentelemetry-instrument python3.12 src/lightspeed_stack.py -c $(CONFIG)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

run: start-llama-stack-container ## Run the service locally with dependent services
@echo "Starting Lightspeed Core Stack..."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ ENV PATH="/app-root/.venv/bin:$PATH"
# Run the application
EXPOSE 8080
ENTRYPOINT ["python3.12", "src/lightspeed_stack.py"]
ENTRYPOINT ["opentelemetry-instrument", "python3.12", "src/lightspeed_stack.py"]
USER 1001
```
Expand Down
2 changes: 1 addition & 1 deletion deploy/lightspeed-stack/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ENV PYTHONPATH="/app-root"

# Run the application
EXPOSE 8080
ENTRYPOINT ["python3.12", "src/lightspeed_stack.py"]
ENTRYPOINT ["opentelemetry-instrument", "python3.12", "src/lightspeed_stack.py"]

LABEL vendor="Red Hat, Inc." \
name="lightspeed-core/lightspeed-stack-rhel9" \
Expand Down
4 changes: 2 additions & 2 deletions docs/user_doc/deployment_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ make run
```

```
uv run src/lightspeed_stack.py
uv run opentelemetry-instrument python3.12 src/lightspeed_stack.py
[07/29/25 15:43:35] INFO Initializing app main.py:19
INFO Including routers main.py:68
INFO: Started server process [1922983]
Expand Down Expand Up @@ -561,7 +561,7 @@ cp examples/lightspeed-stack-lls-library.yaml lightspeed-stack.yaml
```
1. Check the output
```text
uv run src/lightspeed_stack.py
uv run opentelemetry-instrument python3.12 src/lightspeed_stack.py
Using config run.yaml:
apis:
- agents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
key: key
optional: true
image: ${LIGHTSPEED_STACK_IMAGE}
command: ["/bin/sh", "-c", "mkdir -p /tmp/data && exec python3.12 src/lightspeed_stack.py"]
command: ["/bin/sh", "-c", "mkdir -p /tmp/data && exec opentelemetry-instrument python3.12 src/lightspeed_stack.py"]
ports:
- containerPort: 8080
# TCP probes avoid HTTP/auth. LCS + Llama handshake and large images can take 60–120s before :8080 listens;
Expand Down
8 changes: 6 additions & 2 deletions tests/e2e/utils/prow_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ def run_e2e_ops(
)


def wait_for_pod_health(pod_name: str, max_attempts: int = 12) -> None:
"""Wait for pod to be ready in OpenShift/Prow environment."""
def wait_for_pod_health(pod_name: str, max_attempts: int = 20) -> None:
"""Wait for pod to be ready in OpenShift/Prow environment.

Generous number of attempts to account for OpenTelemetry instrumentation
initialization overhead during service startup.
"""
Comment on lines +65 to +70

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Complete the updated function docstring.

Document pod_name, max_attempts, and the None return value using the repository’s Parameters: convention.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/utils/prow_utils.py` around lines 65 - 70, Complete the docstring
for wait_for_pod_health by adding a Parameters: section documenting pod_name and
max_attempts, plus a Returns: section stating that the function returns None.
Follow the repository’s existing docstring convention and preserve the current
behavior.

Sources: Coding guidelines, Learnings

actual_pod_name = get_pod_name(pod_name)
try:
result = run_e2e_ops("wait-for-pod", [actual_pod_name, str(max_attempts)])
Expand Down
14 changes: 9 additions & 5 deletions tests/e2e/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def validate_json(message: Any, schema: Any) -> None:
assert False, "The provided schema is faulty:" + str(e)


def wait_for_container_health(container_name: str, max_attempts: int = 6) -> None:
def wait_for_container_health(container_name: str, max_attempts: int = 20) -> None:
"""Wait for container to be healthy.

Polls a Docker container until its health status becomes `healthy` or the
Expand All @@ -192,14 +192,17 @@ def wait_for_container_health(container_name: str, max_attempts: int = 6) -> Non
inspect errors or timeouts are ignored and retried; the function returns
after the container is observed healthy or after all attempts complete.

OpenTelemetry instrumentation adds initialization overhead, so the default
has been set to 20 attempts (40 seconds) to prevent timeouts.
Comment on lines +195 to +196

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Correct the documented timeout budget.

With 20 attempts, 5-second docker inspect timeouts, and 2-second sleeps, the worst-case wait is about 138 seconds—not 40 seconds. Document the actual upper bound or reduce the per-attempt timeout.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/e2e/utils/utils.py` around lines 195 - 196, Correct the timeout
documentation near the retry configuration in the test utilities to reflect the
actual worst-case duration from 20 attempts, 5-second docker inspect timeouts,
and 2-second sleeps, approximately 138 seconds; alternatively, reduce the
per-attempt timeout so the documented 40-second budget is accurate.


Returns:
-------
None

Parameters:
----------
container_name (str): Docker container name or ID to check.
max_attempts (int): Maximum number of health check attempts (default 6).
max_attempts (int): Maximum number of health check attempts (default 20).
"""
if is_prow_environment():
wait_for_pod_health(container_name, max_attempts)
Expand Down Expand Up @@ -468,9 +471,10 @@ def restart_container(container_name: str) -> None:

# Wait for container to be healthy.
# Library mode embeds llama-stack, so the container takes longer to start
# (~45-60s vs ~10s in server mode). Use a generous attempt count so
# MCP-auth scenarios that restart the container don't time out.
wait_for_container_health(container_name, max_attempts=12)
# (~45-60s vs ~10s in server mode). OpenTelemetry instrumentation adds
# initialization overhead. Use a generous attempt count so MCP-auth scenarios
# that restart the container don't time out.
wait_for_container_health(container_name, max_attempts=20)

if container_name == "llama-stack":
from tests.e2e.features.steps.health import (
Expand Down
Loading