Skip to content

Commit 3999c4a

Browse files
authored
Fix addition of args to generated YAML (#335)
Signed-off-by: Nick Masluk <nick@randombytes.net>
1 parent e56aa4f commit 3999c4a

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

setup/functions.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -974,27 +974,41 @@ def add_command_line_options(args_string):
974974
return ""
975975

976976

977-
def add_additional_env_to_yaml(env_vars_string):
977+
def add_additional_env_to_yaml(env_vars_string: str) -> str:
978978
"""
979979
Generate additional environment variables YAML.
980980
Equivalent to the bash add_additional_env_to_yaml function.
981+
982+
Args:
983+
env_vars_string (str): Comma separated list of environment variable
984+
names to be converted to name/value pairs OR a path to a file
985+
containing a YAML snippet to be indented but otherwise not
986+
interpreted.
987+
988+
Returns:
989+
str: YAML snippet to be inserted to YAML template.
981990
"""
982-
if not env_vars_string:
983-
return ""
984991

985992
# Determine indentation based on environment type
986993
standalone_active = int(os.environ.get("LLMDBENCH_CONTROL_ENVIRONMENT_TYPE_STANDALONE_ACTIVE", 0))
987994
modelservice_active = int(os.environ.get("LLMDBENCH_CONTROL_ENVIRONMENT_TYPE_MODELSERVICE_ACTIVE", 0))
988995

989996
if standalone_active == 1:
990-
name_indent = " " # 8 spaces
991-
value_indent = " " # 10 spaces
997+
name_indent = " " * 8
998+
value_indent = " " * 10
992999
elif modelservice_active == 1:
993-
name_indent = " " # 6 spaces
994-
value_indent = " " # 8 spaces
1000+
name_indent = " " * 6
1001+
value_indent = " " * 8
9951002
else:
996-
name_indent = " " # default 8 spaces
997-
value_indent = " " # default 10 spaces
1003+
name_indent = " " * 8
1004+
value_indent = " " * 10
1005+
1006+
if os.access(env_vars_string, os.R_OK):
1007+
lines = []
1008+
with open(env_vars_string, 'r') as file:
1009+
for line in file:
1010+
lines.append(name_indent + line.rstrip())
1011+
return '\n'.join(lines)
9981012

9991013
# Parse environment variables (comma-separated list)
10001014
env_lines = []

setup/steps/06_deploy_vllm_standalone_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def main():
7878
llmdbench_execute_cmd(
7979
actual_cmd=kubectl_deploy_cmd,
8080
dry_run=int(ev.get("control_dry_run", 0)),
81-
verbose=int(ev.get("control_verbose", 0))
81+
verbose=int(ev.get("control_verbose", 0)),
82+
fatal=True
8283
)
8384

8485
# Generate Service YAML

0 commit comments

Comments
 (0)