Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
This commit is contained in:
Yuan Tang 2024-12-21 12:06:17 -05:00
parent ef214cbfc0
commit 188aef8fa2
No known key found for this signature in database
4 changed files with 8 additions and 9 deletions

View file

@ -293,13 +293,12 @@ class StackBuild(Subcommand):
if template_name: if template_name:
# copy run.yaml from template to build_dir instead of generating it again # copy run.yaml from template to build_dir instead of generating it again
template_path = pkg_resources.resource_filename( template_path = (
"llama_stack", f"templates/{template_name}/run.yaml" importlib.resources.files("llama_stack")
/ f"templates/{template_name}/run.yaml"
) )
os.makedirs(build_dir, exist_ok=True) with importlib.resources.as_file(template_path) as path:
run_config_file = build_dir / f"{build_config.name}-run.yaml" shutil.copy(path, run_config_file)
shutil.copy(template_path, run_config_file)
# Find all ${env.VARIABLE} patterns # Find all ${env.VARIABLE} patterns
cprint("Build Successful!", color="green") cprint("Build Successful!", color="green")
else: else:

View file

@ -52,6 +52,7 @@ class StackRun(Subcommand):
def _run_stack_run_cmd(self, args: argparse.Namespace) -> None: def _run_stack_run_cmd(self, args: argparse.Namespace) -> None:
import importlib.resources import importlib.resources
import yaml import yaml
from llama_stack.distribution.build import ImageType from llama_stack.distribution.build import ImageType

View file

@ -4,13 +4,13 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
import importlib.resources
import logging import logging
from enum import Enum from enum import Enum
from pathlib import Path from pathlib import Path
from typing import Dict, List from typing import Dict, List
import importlib.resources
from pydantic import BaseModel from pydantic import BaseModel
from termcolor import cprint from termcolor import cprint

View file

@ -4,13 +4,12 @@
# This source code is licensed under the terms described in the LICENSE file in # This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree. # the root directory of this source tree.
import importlib.resources
import logging import logging
import os import os
import re import re
from pathlib import Path
from typing import Any, Dict, Optional from typing import Any, Dict, Optional
import importlib.resources
import yaml import yaml
from termcolor import colored from termcolor import colored