Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Triton inference server Server QaUtilSh

From Leeroopedia
Knowledge Sources
Domains Testing, Utilities
Last Updated 2026-02-13 17:00 GMT

Overview

Primary shell utility library sourced by all QA test scripts, providing common functions for server lifecycle management, test execution, and result reporting.

Description

The `util.sh` script is the foundational shell utility for the entire Triton QA test suite. It provides functions for starting and stopping the Triton server process, waiting for server readiness, running test scripts with timeout handling, collecting and reporting test results, and managing environment variables. Key functions include `run_server` for launching tritonserver with proper arguments, `wait_for_server_ready` for polling the health endpoint, and `kill_server` for clean shutdown. Nearly every shell-based QA test begins by sourcing this file to gain access to these common operations.

Usage

Source this file at the top of any QA shell test script to gain access to server management and test helper functions. Set the required environment variables (SERVER, SERVER_ARGS, etc.) before calling the provided functions.

Code Reference

Source Location

Signature

run_server() { ... }              # Start tritonserver with $SERVER and $SERVER_ARGS
run_server_tolive() { ... }       # Start server and wait until live endpoint responds
wait_for_server_ready() { ... }   # Poll health endpoint until server is ready or timeout
kill_server() { ... }             # Gracefully stop the server process
set_server_args() { ... }        # Configure server arguments from environment
report_results() { ... }         # Summarize pass/fail counts and exit with appropriate code

Import

source ../common/util.sh
# or with absolute path
source /path/to/qa/common/util.sh

I/O Contract

Inputs

Name Type Required Description
SERVER env var Yes Path to the tritonserver binary
SERVER_ARGS env var Yes Command-line arguments for the tritonserver process
SERVER_LOG env var No Path to the server log file (default: ./server.log)
SERVER_TIMEOUT env var No Timeout in seconds for server readiness (default: 120)
REPO_VERSION env var No Repository version tag for locating test data

Outputs

Name Type Description
SERVER_PID env var PID of the launched tritonserver process
exit_code int Overall test result exit code (0=pass, 1=fail)
server.log file Server stdout/stderr log captured during the test run

Usage Examples

Standard QA Test Script Pattern

source ../common/util.sh
SERVER=/opt/tritonserver/bin/tritonserver
SERVER_ARGS="--model-repository=/models --log-verbose=1"
run_server
wait_for_server_ready $SERVER_PID 120
# ... run tests ...
kill_server

Using report_results

RET=0
set +e
python test_infer.py >>$CLIENT_LOG 2>&1
if [ $? -ne 0 ]; then RET=1; fi
set -e
kill_server
report_results $RET

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment