Skip to content

Commit 373bb69

Browse files
[Ready to review] Refactoring SMC env variable config (#1232)
2 parents 30370d4 + dccd018 commit 373bb69

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

ads/aqua/config/container_config.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,28 @@ def from_service_config(
191191
additional_configurations.get("modelFormats")
192192
)
193193

194-
# Parse environment variables from `additional_configurations`.
195-
# Only keys present in the configuration will be added to the result.
196-
config_keys = {
197-
"MODEL_DEPLOY_PREDICT_ENDPOINT": UNKNOWN,
198-
"MODEL_DEPLOY_HEALTH_ENDPOINT": UNKNOWN,
199-
"PORT": UNKNOWN,
200-
"HEALTH_CHECK_PORT": UNKNOWN,
201-
"VLLM_USE_V1": UNKNOWN,
202-
}
203-
204-
env_vars = [
205-
{key: additional_configurations.get(key, default)}
206-
for key, default in config_keys.items()
207-
if key in additional_configurations
208-
]
194+
# TODO: Remove the else condition once SMC env variable config is updated everywhere
195+
if additional_configurations.get("env_vars", None):
196+
env_vars_dict = json.loads(
197+
additional_configurations.get("env_vars") or "{}"
198+
)
199+
env_vars = [
200+
{key: str(value)} for key, value in env_vars_dict.items()
201+
]
202+
else:
203+
config_keys = {
204+
"MODEL_DEPLOY_PREDICT_ENDPOINT": UNKNOWN,
205+
"MODEL_DEPLOY_HEALTH_ENDPOINT": UNKNOWN,
206+
"PORT": UNKNOWN,
207+
"HEALTH_CHECK_PORT": UNKNOWN,
208+
"VLLM_USE_V1": UNKNOWN,
209+
}
210+
211+
env_vars = [
212+
{key: additional_configurations.get(key, default)}
213+
for key, default in config_keys.items()
214+
if key in additional_configurations
215+
]
209216

210217
# Build container spec
211218
container_item.spec = AquaContainerConfigSpec(

0 commit comments

Comments
 (0)