mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
chore: make cprint write to stderr (#2250)
Also do sys.exit(1) in case of errors
This commit is contained in:
parent
c25bd0ad58
commit
5a422e236c
11 changed files with 81 additions and 44 deletions
|
@ -8,6 +8,7 @@ import logging
|
|||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from termcolor import cprint
|
||||
|
||||
|
@ -33,6 +34,7 @@ def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
|||
cprint(
|
||||
"No current conda environment detected, please specify a conda environment name with --image-name",
|
||||
color="red",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -49,12 +51,13 @@ def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
|||
return envpath
|
||||
return None
|
||||
|
||||
print(f"Using conda environment: {env_name}")
|
||||
cprint(f"Using conda environment: {env_name}", color="green", file=sys.stderr)
|
||||
conda_prefix = get_conda_prefix(env_name)
|
||||
if not conda_prefix:
|
||||
cprint(
|
||||
f"Conda environment {env_name} does not exist.",
|
||||
color="red",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return
|
||||
|
||||
|
@ -63,6 +66,7 @@ def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
|||
cprint(
|
||||
f"Build file {build_file} does not exist.\n\nPlease run `llama stack build` or specify the correct conda environment name with --image-name",
|
||||
color="red",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return
|
||||
else:
|
||||
|
@ -73,9 +77,10 @@ def formulate_run_args(image_type, image_name, config, template_name) -> list:
|
|||
cprint(
|
||||
"No current virtual environment detected, please specify a virtual environment name with --image-name",
|
||||
color="red",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return
|
||||
print(f"Using virtual environment: {env_name}")
|
||||
cprint(f"Using virtual environment: {env_name}", file=sys.stderr)
|
||||
|
||||
script = importlib.resources.files("llama_stack") / "distribution/start_stack.sh"
|
||||
run_args = [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue