| 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) Meta Platforms, Inc. and affiliates. |
| 4 | # All rights reserved. |
| 5 | # |
| 6 | # This source code is licensed under the terms described in the LICENSE file in |
| 7 | # the root directory of this source tree. |
| 8 | |
| 9 | set -euo pipefail |
| 10 | |
| 11 | RED='\033[0;31m' |
| 12 | NC='\033[0m' # No Color |
| 13 | |
| 14 | error_handler() { |
| 15 | echo "Error occurred in script at line: ${1}" >&2 |
| 16 | exit 1 |
| 17 | } |
| 18 | |
| 19 | trap 'error_handler ${LINENO}' ERR |
| 20 | |
| 21 | if [ $# -lt 3 ]; then |
| 22 | echo "Usage: $0 <build_name> <yaml_config> <port> <script_args...>" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | build_name="$1" |
| 27 | env_name="llamastack-$build_name" |
| 28 | shift |
| 29 | |
| 30 | yaml_config="$1" |
| 31 | shift |
| 32 | |
| 33 | port="$1" |
| 34 | shift |
| 35 | |
| 36 | eval "$(conda shell.bash hook)" |
| 37 | conda deactivate && conda activate "$env_name" |
| 38 | |
| 39 | $CONDA_PREFIX/bin/python \ |
| 40 | -m llama_stack.distribution.server.server \ |
| 41 | --yaml_config "$yaml_config" \ |
| 42 | --port "$port" "$@" |