mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-29 03:14:19 +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
|
from termcolor import cprint
|
||||||
|
|
||||||
docker_image = None
|
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}"
|
conda_dir = Path(os.getenv("CONDA_PREFIX")).parent / f"llamastack-{args.config}"
|
||||||
build_config_file = Path(conda_dir) / f"{args.config}-build.yaml"
|
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(
|
cprint(
|
||||||
f"Could not find {build_config_file}. Trying docker image name instead...",
|
f"Could not find {build_config_file}. Trying docker image name instead...",
|
||||||
color="green",
|
color="green",
|
||||||
)
|
)
|
||||||
docker_image = args.config
|
docker_image = args.config
|
||||||
|
|
||||||
builds_dir = BUILDS_BASE_DIR / ImageType.docker.value
|
builds_dir = BUILDS_BASE_DIR / ImageType.docker.value
|
||||||
if args.output_dir:
|
if args.output_dir:
|
||||||
builds_dir = Path(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
|
# we have regenerated the build config file with script, now check if it exists
|
||||||
if return_code != 0:
|
if return_code != 0:
|
||||||
self.parser.error(
|
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-")
|
build_name = docker_image.removeprefix("llamastack-")
|
||||||
saved_file = str(builds_dir / f"{build_name}-run.yaml")
|
saved_file = str(builds_dir / f"{build_name}-run.yaml")
|
||||||
|
@ -89,11 +110,6 @@ class StackConfigure(Subcommand):
|
||||||
)
|
)
|
||||||
return
|
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(
|
def _configure_llama_distribution(
|
||||||
self,
|
self,
|
||||||
build_config: BuildConfig,
|
build_config: BuildConfig,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue