mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 19:04:19 +00:00
fix broken --list-templates with adding build.yaml files for packaging (#327)
* add build files to templates * fix templates * manifest * symlink * symlink * precommit * change everything to docker build.yaml * remove image_type in templates * fix build from templates CLI * fix readmes
This commit is contained in:
parent
afae4e3d8e
commit
07f9bf723f
32 changed files with 161 additions and 158 deletions
|
@ -12,9 +12,7 @@ import os
|
|||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
|
||||
TEMPLATES_PATH = (
|
||||
Path(os.path.relpath(__file__)).parent.parent.parent.parent / "distributions"
|
||||
)
|
||||
TEMPLATES_PATH = Path(os.path.relpath(__file__)).parent.parent.parent / "templates"
|
||||
|
||||
|
||||
@lru_cache()
|
||||
|
@ -26,7 +24,6 @@ def available_templates_specs() -> List[BuildConfig]:
|
|||
with open(p, "r") as f:
|
||||
build_config = BuildConfig(**yaml.safe_load(f))
|
||||
template_specs.append(build_config)
|
||||
|
||||
return template_specs
|
||||
|
||||
|
||||
|
@ -99,19 +96,22 @@ class StackBuild(Subcommand):
|
|||
"You must specify a name for the build using --name when using a template"
|
||||
)
|
||||
return
|
||||
build_path = TEMPLATES_PATH / f"{args.template}-build.yaml"
|
||||
if not build_path.exists():
|
||||
self.parser.error(
|
||||
f"Could not find template {args.template}. Please run `llama stack build --list-templates` to check out the available templates"
|
||||
)
|
||||
return
|
||||
with open(build_path, "r") as f:
|
||||
build_config = BuildConfig(**yaml.safe_load(f))
|
||||
build_config.name = args.name
|
||||
if args.image_type:
|
||||
build_config.image_type = args.image_type
|
||||
self._run_stack_build_command_from_build_config(build_config)
|
||||
available_templates = available_templates_specs()
|
||||
for build_config in available_templates:
|
||||
if build_config.name == args.template:
|
||||
build_config.name = args.name
|
||||
if args.image_type:
|
||||
build_config.image_type = args.image_type
|
||||
else:
|
||||
self.parser.error(
|
||||
f"Please specify a image-type (docker | conda) for {args.template}"
|
||||
)
|
||||
self._run_stack_build_command_from_build_config(build_config)
|
||||
return
|
||||
|
||||
self.parser.error(
|
||||
f"Could not find template {args.template}. Please run `llama stack build --list-templates` to check out the available templates"
|
||||
)
|
||||
return
|
||||
|
||||
# try to see if we can find a pre-existing build config file through name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue