mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-27 18:50:41 +00:00
refactor: remove container from list of run image types (#2178)
Some checks failed
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 3s
Integration Tests / test-matrix (http, providers) (push) Failing after 8s
Integration Tests / test-matrix (http, agents) (push) Failing after 11s
Integration Tests / test-matrix (http, datasets) (push) Failing after 12s
Integration Tests / test-matrix (http, scoring) (push) Failing after 10s
Integration Tests / test-matrix (library, inference) (push) Failing after 8s
Integration Tests / test-matrix (http, post_training) (push) Failing after 12s
Integration Tests / test-matrix (http, inference) (push) Failing after 12s
Integration Tests / test-matrix (library, agents) (push) Failing after 10s
Integration Tests / test-matrix (http, inspect) (push) Failing after 12s
Integration Tests / test-matrix (library, datasets) (push) Failing after 10s
Integration Tests / test-matrix (http, tool_runtime) (push) Failing after 12s
Integration Tests / test-matrix (library, inspect) (push) Failing after 7s
Test Llama Stack Build / generate-matrix (push) Successful in 5s
Test Llama Stack Build / build-single-provider (push) Failing after 6s
Integration Tests / test-matrix (library, post_training) (push) Failing after 9s
Integration Tests / test-matrix (library, scoring) (push) Failing after 8s
Test Llama Stack Build / build-ubi9-container-distribution (push) Failing after 6s
Integration Tests / test-matrix (library, providers) (push) Failing after 10s
Integration Tests / test-matrix (library, tool_runtime) (push) Failing after 9s
Test External Providers / test-external-providers (venv) (push) Failing after 7s
Unit Tests / unit-tests (3.10) (push) Failing after 9s
Update ReadTheDocs / update-readthedocs (push) Failing after 7s
Unit Tests / unit-tests (3.12) (push) Failing after 7s
Unit Tests / unit-tests (3.13) (push) Failing after 8s
Test Llama Stack Build / build (push) Failing after 7s
Unit Tests / unit-tests (3.11) (push) Failing after 8s
Test Llama Stack Build / build-custom-container-distribution (push) Failing after 30s
Pre-commit / pre-commit (push) Successful in 2m1s
Some checks failed
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 3s
Integration Tests / test-matrix (http, providers) (push) Failing after 8s
Integration Tests / test-matrix (http, agents) (push) Failing after 11s
Integration Tests / test-matrix (http, datasets) (push) Failing after 12s
Integration Tests / test-matrix (http, scoring) (push) Failing after 10s
Integration Tests / test-matrix (library, inference) (push) Failing after 8s
Integration Tests / test-matrix (http, post_training) (push) Failing after 12s
Integration Tests / test-matrix (http, inference) (push) Failing after 12s
Integration Tests / test-matrix (library, agents) (push) Failing after 10s
Integration Tests / test-matrix (http, inspect) (push) Failing after 12s
Integration Tests / test-matrix (library, datasets) (push) Failing after 10s
Integration Tests / test-matrix (http, tool_runtime) (push) Failing after 12s
Integration Tests / test-matrix (library, inspect) (push) Failing after 7s
Test Llama Stack Build / generate-matrix (push) Successful in 5s
Test Llama Stack Build / build-single-provider (push) Failing after 6s
Integration Tests / test-matrix (library, post_training) (push) Failing after 9s
Integration Tests / test-matrix (library, scoring) (push) Failing after 8s
Test Llama Stack Build / build-ubi9-container-distribution (push) Failing after 6s
Integration Tests / test-matrix (library, providers) (push) Failing after 10s
Integration Tests / test-matrix (library, tool_runtime) (push) Failing after 9s
Test External Providers / test-external-providers (venv) (push) Failing after 7s
Unit Tests / unit-tests (3.10) (push) Failing after 9s
Update ReadTheDocs / update-readthedocs (push) Failing after 7s
Unit Tests / unit-tests (3.12) (push) Failing after 7s
Unit Tests / unit-tests (3.13) (push) Failing after 8s
Test Llama Stack Build / build (push) Failing after 7s
Unit Tests / unit-tests (3.11) (push) Failing after 8s
Test Llama Stack Build / build-custom-container-distribution (push) Failing after 30s
Pre-commit / pre-commit (push) Successful in 2m1s
# What does this PR do? [Provide a short summary of what this PR does and why. Link to relevant issues if applicable.] Removes the ability to run llama stack container images through the llama stack CLI Closes #2110 ## Test Plan [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*] Run: ``` llama stack run /path/to/run.yaml --image-type container ``` Expected outcome: ``` llama stack run: error: argument --image-type: invalid choice: 'container' (choose from 'conda', 'venv') ``` [//]: # (## Documentation)
This commit is contained in:
parent
b21050935e
commit
c7be73fb16
4 changed files with 41 additions and 70 deletions
|
@ -260,7 +260,41 @@ Containerfile created successfully in /tmp/tmp.viA3a3Rdsg/ContainerfileFROM pyth
|
||||||
You can now edit ~/meta-llama/llama-stack/tmp/configs/ollama-run.yaml and run `llama stack run ~/meta-llama/llama-stack/tmp/configs/ollama-run.yaml`
|
You can now edit ~/meta-llama/llama-stack/tmp/configs/ollama-run.yaml and run `llama stack run ~/meta-llama/llama-stack/tmp/configs/ollama-run.yaml`
|
||||||
```
|
```
|
||||||
|
|
||||||
After this step is successful, you should be able to find the built container image and test it with `llama stack run <path/to/run.yaml>`.
|
Now set some environment variables for the inference model ID and Llama Stack Port and create a local directory to mount into the container's file system.
|
||||||
|
```
|
||||||
|
export INFERENCE_MODEL="llama3.2:3b"
|
||||||
|
export LLAMA_STACK_PORT=8321
|
||||||
|
mkdir -p ~/.llama
|
||||||
|
```
|
||||||
|
|
||||||
|
After this step is successful, you should be able to find the built container image and test it with the below Docker command:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker run -d \
|
||||||
|
-p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT \
|
||||||
|
-v ~/.llama:/root/.llama \
|
||||||
|
localhost/distribution-ollama:dev \
|
||||||
|
--port $LLAMA_STACK_PORT \
|
||||||
|
--env INFERENCE_MODEL=$INFERENCE_MODEL \
|
||||||
|
--env OLLAMA_URL=http://host.docker.internal:11434
|
||||||
|
```
|
||||||
|
|
||||||
|
Here are the docker flags and their uses:
|
||||||
|
|
||||||
|
* `-d`: Runs the container in the detached mode as a background process
|
||||||
|
|
||||||
|
* `-p $LLAMA_STACK_PORT:$LLAMA_STACK_PORT`: Maps the container port to the host port for accessing the server
|
||||||
|
|
||||||
|
* `-v ~/.llama:/root/.llama`: Mounts the local .llama directory to persist configurations and data
|
||||||
|
|
||||||
|
* `localhost/distribution-ollama:dev`: The name and tag of the container image to run
|
||||||
|
|
||||||
|
* `--port $LLAMA_STACK_PORT`: Port number for the server to listen on
|
||||||
|
|
||||||
|
* `--env INFERENCE_MODEL=$INFERENCE_MODEL`: Sets the model to use for inference
|
||||||
|
|
||||||
|
* `--env OLLAMA_URL=http://host.docker.internal:11434`: Configures the URL for the Ollama service
|
||||||
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
::::
|
::::
|
||||||
|
|
|
@ -59,7 +59,7 @@ class StackRun(Subcommand):
|
||||||
"--image-type",
|
"--image-type",
|
||||||
type=str,
|
type=str,
|
||||||
help="Image Type used during the build. This can be either conda or container or venv.",
|
help="Image Type used during the build. This can be either conda or container or venv.",
|
||||||
choices=[e.value for e in ImageType],
|
choices=[e.value for e in ImageType if e.value != ImageType.CONTAINER.value],
|
||||||
)
|
)
|
||||||
self.parser.add_argument(
|
self.parser.add_argument(
|
||||||
"--enable-ui",
|
"--enable-ui",
|
||||||
|
|
|
@ -7,10 +7,6 @@
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
CONTAINER_BINARY=${CONTAINER_BINARY:-docker}
|
|
||||||
CONTAINER_OPTS=${CONTAINER_OPTS:-}
|
|
||||||
LLAMA_CHECKPOINT_DIR=${LLAMA_CHECKPOINT_DIR:-}
|
|
||||||
LLAMA_STACK_DIR=${LLAMA_STACK_DIR:-}
|
|
||||||
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-}
|
||||||
PYPI_VERSION=${PYPI_VERSION:-}
|
PYPI_VERSION=${PYPI_VERSION:-}
|
||||||
VIRTUAL_ENV=${VIRTUAL_ENV:-}
|
VIRTUAL_ENV=${VIRTUAL_ENV:-}
|
||||||
|
@ -132,63 +128,7 @@ if [[ "$env_type" == "venv" || "$env_type" == "conda" ]]; then
|
||||||
$env_vars \
|
$env_vars \
|
||||||
$other_args
|
$other_args
|
||||||
elif [[ "$env_type" == "container" ]]; then
|
elif [[ "$env_type" == "container" ]]; then
|
||||||
set -x
|
echo -e "${RED}Warning: Llama Stack no longer supports running Containers via the 'llama stack run' command.${NC}"
|
||||||
|
echo -e "Please refer to the documentation for more information: https://llama-stack.readthedocs.io/en/latest/distributions/building_distro.html#llama-stack-build"
|
||||||
# Check if container command is available
|
exit 1
|
||||||
if ! is_command_available $CONTAINER_BINARY; then
|
|
||||||
printf "${RED}Error: ${CONTAINER_BINARY} command not found. Is ${CONTAINER_BINARY} installed and in your PATH?${NC}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if is_command_available selinuxenabled &> /dev/null && selinuxenabled; then
|
|
||||||
# Disable SELinux labels
|
|
||||||
CONTAINER_OPTS="$CONTAINER_OPTS --security-opt label=disable"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mounts=""
|
|
||||||
if [ -n "$LLAMA_STACK_DIR" ]; then
|
|
||||||
mounts="$mounts -v $(readlink -f $LLAMA_STACK_DIR):/app/llama-stack-source"
|
|
||||||
fi
|
|
||||||
if [ -n "$LLAMA_CHECKPOINT_DIR" ]; then
|
|
||||||
mounts="$mounts -v $LLAMA_CHECKPOINT_DIR:/root/.llama"
|
|
||||||
CONTAINER_OPTS="$CONTAINER_OPTS --gpus=all"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$PYPI_VERSION" ]; then
|
|
||||||
version_tag="$PYPI_VERSION"
|
|
||||||
elif [ -n "$LLAMA_STACK_DIR" ]; then
|
|
||||||
version_tag="dev"
|
|
||||||
elif [ -n "$TEST_PYPI_VERSION" ]; then
|
|
||||||
version_tag="test-$TEST_PYPI_VERSION"
|
|
||||||
else
|
|
||||||
if ! is_command_available jq; then
|
|
||||||
echo -e "${RED}Error: jq not found" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
URL="https://pypi.org/pypi/llama-stack/json"
|
|
||||||
version_tag=$(curl -s $URL | jq -r '.info.version')
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Build the command with optional yaml config
|
|
||||||
cmd="$CONTAINER_BINARY run $CONTAINER_OPTS -it \
|
|
||||||
-p $port:$port \
|
|
||||||
$env_vars \
|
|
||||||
$mounts \
|
|
||||||
--env LLAMA_STACK_PORT=$port \
|
|
||||||
--entrypoint python \
|
|
||||||
$container_image:$version_tag \
|
|
||||||
-m llama_stack.distribution.server.server"
|
|
||||||
|
|
||||||
# Add yaml config if provided, otherwise use default
|
|
||||||
if [ -n "$yaml_config" ]; then
|
|
||||||
cmd="$cmd -v $yaml_config:/app/run.yaml --config /app/run.yaml"
|
|
||||||
else
|
|
||||||
cmd="$cmd --config /app/run.yaml"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add any other args
|
|
||||||
cmd="$cmd $other_args"
|
|
||||||
|
|
||||||
# Execute the command
|
|
||||||
eval $cmd
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -23,11 +23,8 @@ from llama_stack.distribution.utils.image_types import LlamaStackImageType
|
||||||
|
|
||||||
def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
||||||
env_name = ""
|
env_name = ""
|
||||||
if image_type == LlamaStackImageType.CONTAINER.value:
|
|
||||||
env_name = (
|
if image_type == LlamaStackImageType.CONDA.value:
|
||||||
f"distribution-{template_name}" if template_name else (config.container_image if config else image_name)
|
|
||||||
)
|
|
||||||
elif image_type == LlamaStackImageType.CONDA.value:
|
|
||||||
current_conda_env = os.environ.get("CONDA_DEFAULT_ENV")
|
current_conda_env = os.environ.get("CONDA_DEFAULT_ENV")
|
||||||
env_name = image_name or current_conda_env
|
env_name = image_name or current_conda_env
|
||||||
if not env_name:
|
if not env_name:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue