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
3 changes: 1 addition & 2 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TODO: Update to official python-3.13-minimal image when available
ARG BASE_IMAGE=quay.io/fedora/python-313-minimal:latest

# Use a multi-stage build to create a lightweight production image
Expand Down Expand Up @@ -51,7 +50,7 @@ USER 1001:0
# Add guidellm bin to PATH
# Argument defaults can be set with GUIDELLM_<ARG>
ENV HOME="/home/guidellm" \
GUIDELLM_OUTPUT_PATH="/results/benchmarks.json"
GUIDELLM_OUTPUT_DIR="/results"

# Create the user home dir
WORKDIR $HOME
Expand Down
19 changes: 16 additions & 3 deletions src/guidellm/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def run(**kwargs):

# Handle output path remapping
if (output_path := kwargs.pop("output_path", None)) is not None:
if kwargs.get("outputs_dir", None) is not None:
raise click.BadParameter("Cannot use --output-path with --output-dir.")
path = Path(output_path)
if path.is_dir():
kwargs["output_dir"] = path
Expand All @@ -414,6 +416,17 @@ def run(**kwargs):
disable_console_interactive = (
kwargs.pop("disable_console_interactive", False) or disable_console
)
console = Console() if not disable_console else None
envs = cli_tools.list_set_env()
if console and envs:
console.print_update(
title=(
"Note: the following environment variables "
"are set and **may** affect configuration"
),
details=", ".join(envs),
status="warning",
)

try:
args = BenchmarkGenerativeTextArgs.create(
Expand All @@ -437,7 +450,7 @@ def run(**kwargs):
if not disable_console_interactive
else None
),
console=Console() if not disable_console else None,
console=console,
)
)

Expand Down Expand Up @@ -523,8 +536,8 @@ def preprocess():
"PreprocessDatasetConfig as JSON string, key=value pairs, "
"or file path (.json, .yaml, .yml, .config). "
"Example: 'prompt_tokens=100,output_tokens=50,prefix_tokens_max=10'"
" or '{\"prompt_tokens\": 100, \"output_tokens\": 50, "
"\"prefix_tokens_max\": 10}'"
' or \'{"prompt_tokens": 100, "output_tokens": 50, '
'"prefix_tokens_max": 10}\''
),
)
@click.option(
Expand Down
12 changes: 12 additions & 0 deletions src/guidellm/utils/cli.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import contextlib
import json
import os
from typing import Any

import click

__all__ = [
"Union",
"format_list_arg",
"list_set_env",
"parse_json",
"parse_list",
"parse_list_floats",
"set_if_not_default",
]


def list_set_env(prefix: str = "GUIDELLM_") -> list[str]:
"""
List all set environment variables prefixed with the given prefix.

:param prefix: The prefix to filter environment variables.
:return: List of environment variable names that are set with the given prefix.
"""
return [key for key in os.environ if key.startswith(prefix)]


def parse_list(ctx, param, value) -> list[str] | None:
"""
Click callback to parse the input value into a list of strings.
Expand Down