mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-14 17:16:09 +00:00
fix: use --template
flag for server (#2643)
# What does this PR do? currently when a template is used, we still use `--config`. `server.py` has a dedicated `--template` flag and logic, use that instead Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
e9926564bd
commit
27b3cd570f
2 changed files with 12 additions and 5 deletions
|
@ -155,8 +155,12 @@ class StackRun(Subcommand):
|
||||||
# func=<bound method StackRun._run_stack_run_cmd of <llama_stack.cli.stack.run.StackRun object at 0x10484b010>>
|
# func=<bound method StackRun._run_stack_run_cmd of <llama_stack.cli.stack.run.StackRun object at 0x10484b010>>
|
||||||
if callable(getattr(args, arg)):
|
if callable(getattr(args, arg)):
|
||||||
continue
|
continue
|
||||||
if arg == "config" and template_name:
|
if arg == "config":
|
||||||
server_args.config = str(config_file)
|
if template_name:
|
||||||
|
server_args.template = str(template_name)
|
||||||
|
else:
|
||||||
|
# Set the config file path
|
||||||
|
server_args.config = str(config_file)
|
||||||
else:
|
else:
|
||||||
setattr(server_args, arg, getattr(args, arg))
|
setattr(server_args, arg, getattr(args, arg))
|
||||||
|
|
||||||
|
@ -168,7 +172,10 @@ class StackRun(Subcommand):
|
||||||
run_args.extend([str(args.port)])
|
run_args.extend([str(args.port)])
|
||||||
|
|
||||||
if config_file:
|
if config_file:
|
||||||
run_args.extend(["--config", str(config_file)])
|
if template_name:
|
||||||
|
run_args.extend(["--template", str(template_name)])
|
||||||
|
else:
|
||||||
|
run_args.extend(["--config", str(config_file)])
|
||||||
|
|
||||||
if args.env:
|
if args.env:
|
||||||
for env_var in args.env:
|
for env_var in args.env:
|
||||||
|
|
|
@ -405,13 +405,13 @@ def main(args: argparse.Namespace | None = None):
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
log_line = ""
|
log_line = ""
|
||||||
if args.config:
|
if hasattr(args, "config") and args.config:
|
||||||
# if the user provided a config file, use it, even if template was specified
|
# if the user provided a config file, use it, even if template was specified
|
||||||
config_file = Path(args.config)
|
config_file = Path(args.config)
|
||||||
if not config_file.exists():
|
if not config_file.exists():
|
||||||
raise ValueError(f"Config file {config_file} does not exist")
|
raise ValueError(f"Config file {config_file} does not exist")
|
||||||
log_line = f"Using config file: {config_file}"
|
log_line = f"Using config file: {config_file}"
|
||||||
elif args.template:
|
elif hasattr(args, "template") and args.template:
|
||||||
config_file = Path(REPO_ROOT) / "llama_stack" / "templates" / args.template / "run.yaml"
|
config_file = Path(REPO_ROOT) / "llama_stack" / "templates" / args.template / "run.yaml"
|
||||||
if not config_file.exists():
|
if not config_file.exists():
|
||||||
raise ValueError(f"Template {args.template} does not exist")
|
raise ValueError(f"Template {args.template} does not exist")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue