Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dynamo
Commits
e3857ba0
Unverified
Commit
e3857ba0
authored
Apr 11, 2025
by
mohammedabdulwahhab
Committed by
GitHub
Apr 11, 2025
Browse files
fix: serviceArgs in config was not getting set for workers (#640)
parent
5394421a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
9 deletions
+29
-9
deploy/dynamo/sdk/src/dynamo/sdk/lib/config.py
deploy/dynamo/sdk/src/dynamo/sdk/lib/config.py
+9
-3
deploy/dynamo/sdk/src/dynamo/sdk/lib/service.py
deploy/dynamo/sdk/src/dynamo/sdk/lib/service.py
+20
-6
No files found.
deploy/dynamo/sdk/src/dynamo/sdk/lib/config.py
View file @
e3857ba0
...
...
@@ -84,14 +84,20 @@ class ServiceConfig(dict):
else
:
args
.
extend
([
f
"--
{
arg_key
}
"
,
str
(
value
)])
# Get service config excluding ServiceArgs if it exists
# We never want args to be generated from the ServiceArgs
service_config
=
self
[
service_name
].
copy
()
if
"ServiceArgs"
in
service_config
:
del
service_config
[
"ServiceArgs"
]
if
(
common
:
=
self
.
get
(
COMMON_CONFIG_SERVICE
))
is
not
None
and
(
common_config_keys
:
=
self
[
service_
name
]
.
get
(
COMMON_CONFIG_KEY
)
common_config_keys
:
=
service_
config
.
get
(
COMMON_CONFIG_KEY
)
)
is
not
None
:
for
key
in
common_config_keys
:
if
key
in
common
and
key
not
in
self
[
service_
name
]
:
if
key
in
common
and
key
not
in
service_
config
:
add_to_args
(
args
,
key
,
common
[
key
])
for
key
,
value
in
self
[
service_
name
]
.
items
():
for
key
,
value
in
service_
config
.
items
():
add_to_args
(
args
,
key
,
value
)
logger
.
info
(
f
"Running
{
service_name
}
with
{
args
=
}
"
)
...
...
deploy/dynamo/sdk/src/dynamo/sdk/lib/service.py
View file @
e3857ba0
...
...
@@ -90,15 +90,32 @@ class DynamoService(Service[T]):
super
().
__init__
(
config
=
config
,
inner
=
inner
,
image
=
image
,
envs
=
envs
or
[])
# Initialize Dynamo configuration
self
.
_dynamo_config
=
(
# Get any dynamo overrides from service_args
dynamo_overrides
=
{}
if
service_args
and
"dynamo"
in
service_args
:
dynamo_overrides
=
service_args
[
"dynamo"
]
logger
.
debug
(
f
"Found dynamo overrides in service_args:
{
dynamo_overrides
}
"
)
# Initialize Dynamo configuration with overrides
base_config
=
(
dynamo_config
if
dynamo_config
else
DynamoConfig
(
name
=
inner
.
__name__
,
namespace
=
"default"
)
)
logger
.
debug
(
f
"Initial base DynamoConfig:
{
asdict
(
base_config
)
}
"
)
# Apply overrides from service_args to base config
for
key
,
value
in
dynamo_overrides
.
items
():
if
hasattr
(
base_config
,
key
):
logger
.
debug
(
f
"Applying override:
{
key
}
=
{
value
}
"
)
setattr
(
base_config
,
key
,
value
)
self
.
_dynamo_config
=
base_config
if
self
.
_dynamo_config
.
name
is
None
:
self
.
_dynamo_config
.
name
=
inner
.
__name__
logger
.
debug
(
f
"Final DynamoConfig:
{
asdict
(
self
.
_dynamo_config
)
}
"
)
# Add dynamo configuration to the service config
# this allows for the config to be part of the service in bento.yaml
self
.
config
[
"dynamo"
]
=
asdict
(
self
.
_dynamo_config
)
...
...
@@ -182,6 +199,7 @@ class DynamoService(Service[T]):
def
_remove_service_args
(
self
,
service_name
:
str
):
"""Remove ServiceArgs from the environment config after using them, preserving envs"""
logger
.
debug
(
f
"Removing service args for
{
service_name
}
"
)
config_str
=
os
.
environ
.
get
(
"DYNAMO_SERVICE_CONFIG"
)
if
config_str
:
config
=
json
.
loads
(
config_str
)
...
...
@@ -198,10 +216,6 @@ class DynamoService(Service[T]):
}
os
.
environ
[
"DYNAMO_SERVICE_ENVS"
]
=
json
.
dumps
(
envs_config
)
# Remove ServiceArgs from main config
del
config
[
service_name
][
"ServiceArgs"
]
os
.
environ
[
"DYNAMO_SERVICE_CONFIG"
]
=
json
.
dumps
(
config
)
def
service
(
inner
:
Optional
[
type
[
T
]]
=
None
,
...
...
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