Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
c95031ed
Unverified
Commit
c95031ed
authored
Jun 25, 2025
by
hhzhang16
Committed by
GitHub
Jun 25, 2025
Browse files
fix: boolean flags can now be set in ServiceConfig (#1630)
parent
6032c82f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
deploy/sdk/src/dynamo/sdk/lib/config.py
deploy/sdk/src/dynamo/sdk/lib/config.py
+3
-1
deploy/sdk/src/dynamo/sdk/tests/test_config.py
deploy/sdk/src/dynamo/sdk/tests/test_config.py
+38
-0
No files found.
deploy/sdk/src/dynamo/sdk/lib/config.py
View file @
c95031ed
...
...
@@ -105,7 +105,9 @@ class ServiceConfig(dict):
# Convert to CLI format
if
isinstance
(
value
,
bool
):
if
value
:
args
.
append
(
f
"--
{
arg_key
}
"
)
args
.
extend
([
f
"--
{
arg_key
}
"
,
"true"
])
else
:
args
.
extend
([
f
"--
{
arg_key
}
"
,
"false"
])
elif
isinstance
(
value
,
dict
):
args
.
extend
([
f
"--
{
arg_key
}
"
,
json
.
dumps
(
value
)])
else
:
...
...
deploy/sdk/src/dynamo/sdk/tests/test_config.py
View file @
c95031ed
...
...
@@ -140,3 +140,41 @@ def test_service_config_override_common_configs():
assert
f
"--
{
key
}
"
in
vllm_worker_args
assert
vllm_worker_args
[
vllm_worker_args
.
index
(
"--block-size"
)
+
1
]
==
"128"
def
test_explicit_boolean_arguments
():
"""Test that boolean arguments are handled with explicit true/false values"""
# Reset singleton instance
ServiceConfig
.
_instance
=
None
# Set environment variable with boolean configs
os
.
environ
[
"DYNAMO_SERVICE_CONFIG"
]
=
"""
{
"VllmWorker": {
"enable-prefix-caching": true,
"disable-sliding-window": false,
"enforce-eager": true
}
}
"""
# Get arguments and verify explicit boolean handling
service_config
=
ServiceConfig
.
get_instance
()
vllm_worker_args
=
service_config
.
as_args
(
"VllmWorker"
)
# Check that true values are passed as --arg true
assert
"--enable-prefix-caching"
in
vllm_worker_args
enable_idx
=
vllm_worker_args
.
index
(
"--enable-prefix-caching"
)
assert
vllm_worker_args
[
enable_idx
+
1
]
==
"true"
# Check that false values are passed as --arg false
assert
"--disable-sliding-window"
in
vllm_worker_args
disable_idx
=
vllm_worker_args
.
index
(
"--disable-sliding-window"
)
assert
vllm_worker_args
[
disable_idx
+
1
]
==
"false"
# Check that another true value works
assert
"--enforce-eager"
in
vllm_worker_args
enforce_idx
=
vllm_worker_args
.
index
(
"--enforce-eager"
)
assert
vllm_worker_args
[
enforce_idx
+
1
]
==
"true"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment