mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-14 17:16:09 +00:00
test: terminate server process when finished (#2700)
Some checks failed
Vector IO Integration Tests / test-matrix (3.12, remote::chromadb) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.12, remote::pgvector) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.13, inline::faiss) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.13, remote::chromadb) (push) Failing after 7s
Vector IO Integration Tests / test-matrix (3.13, inline::milvus) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.13, inline::sqlite-vec) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.13, remote::pgvector) (push) Failing after 10s
Python Package Build Test / build (3.12) (push) Failing after 7s
Python Package Build Test / build (3.13) (push) Failing after 8s
Test External Providers / test-external-providers (venv) (push) Failing after 10s
Unit Tests / unit-tests (3.12) (push) Failing after 9s
Unit Tests / unit-tests (3.13) (push) Failing after 8s
Pre-commit / pre-commit (push) Successful in 1m31s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 5s
Integration Tests / test-matrix (library, 3.12, post_training) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.12, datasets) (push) Failing after 15s
Integration Tests / test-matrix (library, 3.12, inference) (push) Failing after 13s
Integration Tests / test-matrix (library, 3.12, safety) (push) Failing after 12s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 19s
Integration Tests / test-matrix (library, 3.13, post_training) (push) Failing after 12s
Integration Tests / test-matrix (library, 3.12, agents) (push) Failing after 22s
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 24s
Integration Tests / test-matrix (library, 3.12, vector_io) (push) Failing after 23s
Integration Tests / test-matrix (library, 3.12, scoring) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, agents) (push) Failing after 18s
Integration Tests / test-matrix (library, 3.13, safety) (push) Failing after 8s
Integration Tests / test-matrix (server, 3.12, post_training) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.13, datasets) (push) Failing after 18s
Integration Tests / test-matrix (library, 3.13, providers) (push) Failing after 14s
Integration Tests / test-matrix (library, 3.12, tool_runtime) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, tool_runtime) (push) Failing after 9s
Integration Tests / test-matrix (server, 3.12, safety) (push) Failing after 13s
Integration Tests / test-matrix (library, 3.13, scoring) (push) Failing after 6s
Integration Tests / test-matrix (library, 3.13, vector_io) (push) Failing after 11s
Integration Tests / test-matrix (library, 3.12, providers) (push) Failing after 24s
Integration Tests / test-matrix (library, 3.12, inspect) (push) Failing after 22s
Integration Tests / test-matrix (library, 3.13, inference) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, inspect) (push) Failing after 16s
Integration Tests / test-matrix (server, 3.12, agents) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, inference) (push) Failing after 11s
Integration Tests / test-matrix (server, 3.12, datasets) (push) Failing after 13s
Integration Tests / test-matrix (server, 3.12, inspect) (push) Failing after 13s
Integration Tests / test-matrix (server, 3.12, providers) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, scoring) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, tool_runtime) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.12, vector_io) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, agents) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, datasets) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, inference) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, inspect) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, post_training) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, providers) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, safety) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, scoring) (push) Failing after 5s
Integration Tests / test-matrix (server, 3.13, tool_runtime) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, vector_io) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.12, inline::faiss) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.12, inline::milvus) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.12, inline::sqlite-vec) (push) Failing after 6s
Some checks failed
Vector IO Integration Tests / test-matrix (3.12, remote::chromadb) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.12, remote::pgvector) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.13, inline::faiss) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.13, remote::chromadb) (push) Failing after 7s
Vector IO Integration Tests / test-matrix (3.13, inline::milvus) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.13, inline::sqlite-vec) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.13, remote::pgvector) (push) Failing after 10s
Python Package Build Test / build (3.12) (push) Failing after 7s
Python Package Build Test / build (3.13) (push) Failing after 8s
Test External Providers / test-external-providers (venv) (push) Failing after 10s
Unit Tests / unit-tests (3.12) (push) Failing after 9s
Unit Tests / unit-tests (3.13) (push) Failing after 8s
Pre-commit / pre-commit (push) Successful in 1m31s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 5s
Integration Tests / test-matrix (library, 3.12, post_training) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.12, datasets) (push) Failing after 15s
Integration Tests / test-matrix (library, 3.12, inference) (push) Failing after 13s
Integration Tests / test-matrix (library, 3.12, safety) (push) Failing after 12s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 19s
Integration Tests / test-matrix (library, 3.13, post_training) (push) Failing after 12s
Integration Tests / test-matrix (library, 3.12, agents) (push) Failing after 22s
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 24s
Integration Tests / test-matrix (library, 3.12, vector_io) (push) Failing after 23s
Integration Tests / test-matrix (library, 3.12, scoring) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, agents) (push) Failing after 18s
Integration Tests / test-matrix (library, 3.13, safety) (push) Failing after 8s
Integration Tests / test-matrix (server, 3.12, post_training) (push) Failing after 8s
Integration Tests / test-matrix (library, 3.13, datasets) (push) Failing after 18s
Integration Tests / test-matrix (library, 3.13, providers) (push) Failing after 14s
Integration Tests / test-matrix (library, 3.12, tool_runtime) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, tool_runtime) (push) Failing after 9s
Integration Tests / test-matrix (server, 3.12, safety) (push) Failing after 13s
Integration Tests / test-matrix (library, 3.13, scoring) (push) Failing after 6s
Integration Tests / test-matrix (library, 3.13, vector_io) (push) Failing after 11s
Integration Tests / test-matrix (library, 3.12, providers) (push) Failing after 24s
Integration Tests / test-matrix (library, 3.12, inspect) (push) Failing after 22s
Integration Tests / test-matrix (library, 3.13, inference) (push) Failing after 20s
Integration Tests / test-matrix (library, 3.13, inspect) (push) Failing after 16s
Integration Tests / test-matrix (server, 3.12, agents) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, inference) (push) Failing after 11s
Integration Tests / test-matrix (server, 3.12, datasets) (push) Failing after 13s
Integration Tests / test-matrix (server, 3.12, inspect) (push) Failing after 13s
Integration Tests / test-matrix (server, 3.12, providers) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, scoring) (push) Failing after 14s
Integration Tests / test-matrix (server, 3.12, tool_runtime) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.12, vector_io) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, agents) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, datasets) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, inference) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, inspect) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, post_training) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, providers) (push) Failing after 7s
Integration Tests / test-matrix (server, 3.13, safety) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, scoring) (push) Failing after 5s
Integration Tests / test-matrix (server, 3.13, tool_runtime) (push) Failing after 6s
Integration Tests / test-matrix (server, 3.13, vector_io) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.12, inline::faiss) (push) Failing after 6s
Vector IO Integration Tests / test-matrix (3.12, inline::milvus) (push) Failing after 5s
Vector IO Integration Tests / test-matrix (3.12, inline::sqlite-vec) (push) Failing after 6s
# What does this PR do? Terminate server process for real. ## Test Plan ```ENABLE_OPENAI=openai LLAMA_STACK_CONFIG=server:starter pytest -v tests/integration/agents/test_openai_responses.py --text-model "gpt-4o-mini" -vv -s -k 'test_list_response_input_items[' && lsof -ti:8321``` observe no process printed anymore
This commit is contained in:
parent
780b4c6eea
commit
81109a0f72
1 changed files with 10 additions and 4 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import os
|
import os
|
||||||
|
import signal
|
||||||
import socket
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
|
@ -45,6 +46,8 @@ def start_llama_stack_server(config_name: str) -> subprocess.Popen:
|
||||||
stderr=subprocess.PIPE, # keep stderr to see errors
|
stderr=subprocess.PIPE, # keep stderr to see errors
|
||||||
text=True,
|
text=True,
|
||||||
env={**os.environ, "LLAMA_STACK_LOG_FILE": "server.log"},
|
env={**os.environ, "LLAMA_STACK_LOG_FILE": "server.log"},
|
||||||
|
# Create new process group so we can kill all child processes
|
||||||
|
preexec_fn=os.setsid,
|
||||||
)
|
)
|
||||||
return process
|
return process
|
||||||
|
|
||||||
|
@ -267,14 +270,17 @@ def cleanup_server_process(request):
|
||||||
print(f"Server process already terminated with return code: {server_process.returncode}")
|
print(f"Server process already terminated with return code: {server_process.returncode}")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
server_process.terminate()
|
print(f"Terminating process {server_process.pid} and its group...")
|
||||||
|
# Kill the entire process group
|
||||||
|
os.killpg(os.getpgid(server_process.pid), signal.SIGTERM)
|
||||||
server_process.wait(timeout=10)
|
server_process.wait(timeout=10)
|
||||||
print("Server process terminated gracefully")
|
print("Server process and children terminated gracefully")
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
print("Server process did not terminate gracefully, killing it")
|
print("Server process did not terminate gracefully, killing it")
|
||||||
server_process.kill()
|
# Force kill the entire process group
|
||||||
|
os.killpg(os.getpgid(server_process.pid), signal.SIGKILL)
|
||||||
server_process.wait()
|
server_process.wait()
|
||||||
print("Server process killed")
|
print("Server process and children killed")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error during server cleanup: {e}")
|
print(f"Error during server cleanup: {e}")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue