Update documentation again and add error messages to llama stack start

This commit is contained in:
Ashwin Bharambe 2024-09-02 21:36:32 -07:00
parent 279565499b
commit fab6bd1728
2 changed files with 13 additions and 18 deletions

View file

@ -65,25 +65,23 @@ class StackStart(Subcommand):
from llama_toolchain.common.exec import run_with_pty
from llama_toolchain.core.package import BuildType
if args.name.endswith(".yaml"):
path = args.name
else:
build_type = BuildType(args.type)
build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor()
path = build_dir / f"{args.name}.yaml"
build_type = BuildType(args.type)
build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor()
path = build_dir / f"{args.name}.yaml"
config_file = Path(path)
if not config_file.exists():
self.parser.error(
f"File {str(config_file)} does not exist. Did you run `llama stack build`?"
)
return
with open(config_file, "r") as f:
config = PackageConfig(**yaml.safe_load(f))
if not config.distribution_id:
# this is technically not necessary. everything else continues to work,
# but maybe we want to be very clear for the users
self.parser.error(
"No distribution_id found. Did you want to start a provider?"
)
return
raise ValueError("Build config appears to be corrupt.")
if config.docker_image:
script = pkg_resources.resource_filename(