mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
fix docker configure
This commit is contained in:
parent
5ec64ac68c
commit
f5d5e32d62
1 changed files with 45 additions and 29 deletions
|
@ -53,16 +53,36 @@ class StackConfigure(Subcommand):
|
|||
from termcolor import cprint
|
||||
|
||||
docker_image = None
|
||||
|
||||
build_config_file = Path(args.config)
|
||||
|
||||
if build_config_file.exists():
|
||||
with open(build_config_file, "r") as f:
|
||||
build_config = BuildConfig(**yaml.safe_load(f))
|
||||
self._configure_llama_distribution(build_config, args.output_dir)
|
||||
return
|
||||
|
||||
# if we get here, we need to try to find the conda build config file
|
||||
cprint(
|
||||
f"Could not find {build_config_file}. Trying conda build name instead...",
|
||||
color="green",
|
||||
)
|
||||
conda_dir = Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}"
|
||||
build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"
|
||||
|
||||
if not build_config_file.exists():
|
||||
if build_config_file.exists():
|
||||
with open(build_config_file, "r") as f:
|
||||
build_config = BuildConfig(**yaml.safe_load(f))
|
||||
|
||||
self._configure_llama_distribution(build_config, args.output_dir)
|
||||
return
|
||||
|
||||
# if we get here, we need to try to find the docker image
|
||||
cprint(
|
||||
f"Could not find {build_config_file}. Trying docker image name instead...",
|
||||
color="green",
|
||||
)
|
||||
docker_image = args.config
|
||||
|
||||
builds_dir = BUILDS_BASE_DIR / ImageType.docker.value
|
||||
if args.output_dir:
|
||||
builds_dir = Path(output_dir)
|
||||
|
@ -78,8 +98,9 @@ class StackConfigure(Subcommand):
|
|||
# we have regenerated the build config file with script, now check if it exists
|
||||
if return_code != 0:
|
||||
self.parser.error(
|
||||
f"Can not find {build_config_file}. Please run llama stack build first or check if docker image exists"
|
||||
f"Failed to configure container {docker_image} with return code {return_code}. Please run `llama stack build first`. "
|
||||
)
|
||||
return
|
||||
|
||||
build_name = docker_image.removeprefix("llamastack-")
|
||||
saved_file = str(builds_dir / f"{build_name}-run.yaml")
|
||||
|
@ -89,11 +110,6 @@ class StackConfigure(Subcommand):
|
|||
)
|
||||
return
|
||||
|
||||
with open(build_config_file, "r") as f:
|
||||
build_config = BuildConfig(**yaml.safe_load(f))
|
||||
|
||||
self._configure_llama_distribution(build_config, args.output_dir)
|
||||
|
||||
def _configure_llama_distribution(
|
||||
self,
|
||||
build_config: BuildConfig,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue