mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 10:54:19 +00:00
Add config file based CLI (#60)
* config file for build * fix build command * configure script with config * fix configure script to work with config file * update build.sh * update readme * distribution_type -> distribution * fix run-config/config-file to config * move import to inline * only consume config as argument * update configure to only consume config * update readme * update readme
This commit is contained in:
parent
58def874a9
commit
89300df5dc
8 changed files with 155 additions and 111 deletions
|
@ -29,24 +29,12 @@ class StackRun(Subcommand):
|
|||
self.parser.set_defaults(func=self._run_stack_run_cmd)
|
||||
|
||||
def _add_arguments(self):
|
||||
from llama_toolchain.core.package import BuildType
|
||||
from llama_toolchain.core.package import ImageType
|
||||
|
||||
self.parser.add_argument(
|
||||
"distribution",
|
||||
"config",
|
||||
type=str,
|
||||
help="Distribution whose build you want to start",
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--name",
|
||||
type=str,
|
||||
help="Name of the build you want to start",
|
||||
required=True,
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--type",
|
||||
type=str,
|
||||
default="conda_env",
|
||||
choices=[v.value for v in BuildType],
|
||||
help="Path to config file to use for the run",
|
||||
)
|
||||
self.parser.add_argument(
|
||||
"--port",
|
||||
|
@ -63,12 +51,13 @@ class StackRun(Subcommand):
|
|||
|
||||
def _run_stack_run_cmd(self, args: argparse.Namespace) -> None:
|
||||
from llama_toolchain.common.exec import run_with_pty
|
||||
from llama_toolchain.core.package import BuildType
|
||||
from llama_toolchain.core.package import ImageType
|
||||
|
||||
build_type = BuildType(args.type)
|
||||
build_dir = BUILDS_BASE_DIR / args.distribution / build_type.descriptor()
|
||||
path = build_dir / f"{args.name}.yaml"
|
||||
if not args.config:
|
||||
self.parser.error("Must specify a config file to run")
|
||||
return
|
||||
|
||||
path = args.config
|
||||
config_file = Path(path)
|
||||
|
||||
if not config_file.exists():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue