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
98a5fab1
Unverified
Commit
98a5fab1
authored
May 30, 2025
by
Biswa Panda
Committed by
GitHub
May 30, 2025
Browse files
fix: resources naming (#1302)
parent
ef66a1c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
12 deletions
+9
-12
deploy/sdk/src/dynamo/sdk/cli/build.py
deploy/sdk/src/dynamo/sdk/cli/build.py
+3
-3
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py
+5
-8
examples/hello_world/hello_world.py
examples/hello_world/hello_world.py
+1
-1
No files found.
deploy/sdk/src/dynamo/sdk/cli/build.py
View file @
98a5fab1
...
@@ -101,7 +101,7 @@ class ServiceConfig(BaseModel):
...
@@ -101,7 +101,7 @@ class ServiceConfig(BaseModel):
service
:
str
=
""
# Fully qualified service name
service
:
str
=
""
# Fully qualified service name
models
:
t
.
List
[
str
]
=
Field
(
default_factory
=
list
)
models
:
t
.
List
[
str
]
=
Field
(
default_factory
=
list
)
dependencies
:
t
.
List
[
str
]
=
Field
(
default_factory
=
list
)
dependencies
:
t
.
List
[
str
]
=
Field
(
default_factory
=
list
)
resource
:
t
.
Dict
[
str
,
t
.
Any
]
=
Field
(
default_factory
=
dict
)
resource
s
:
t
.
Dict
[
str
,
t
.
Any
]
=
Field
(
default_factory
=
dict
)
workers
:
t
.
Optional
[
int
]
=
None
workers
:
t
.
Optional
[
int
]
=
None
image
:
str
=
"dynamo:latest"
image
:
str
=
"dynamo:latest"
dynamo
:
t
.
Dict
[
str
,
t
.
Any
]
=
Field
(
default_factory
=
dict
)
dynamo
:
t
.
Dict
[
str
,
t
.
Any
]
=
Field
(
default_factory
=
dict
)
...
@@ -138,7 +138,7 @@ class ServiceInfo(BaseModel):
...
@@ -138,7 +138,7 @@ class ServiceInfo(BaseModel):
config
=
ServiceConfig
(
config
=
ServiceConfig
(
name
=
name
,
name
=
name
,
service
=
""
,
service
=
""
,
resource
=
service
.
config
.
resources
.
model_dump
(),
resource
s
=
service
.
config
.
resources
.
model_dump
(),
workers
=
service
.
config
.
workers
,
workers
=
service
.
config
.
workers
,
image
=
image
,
image
=
image
,
dynamo
=
service
.
config
.
dynamo
.
model_dump
(),
dynamo
=
service
.
config
.
dynamo
.
model_dump
(),
...
@@ -212,7 +212,7 @@ class ManifestInfo(BaseModel):
...
@@ -212,7 +212,7 @@ class ManifestInfo(BaseModel):
"name"
:
service
[
"name"
],
"name"
:
service
[
"name"
],
"service"
:
service
[
"config"
][
"service"
],
"service"
:
service
[
"config"
][
"service"
],
"config"
:
{
"config"
:
{
"resource"
:
service
[
"config"
][
"resource"
],
"resource
s
"
:
service
[
"config"
][
"resource
s
"
],
"workers"
:
service
[
"config"
][
"workers"
],
"workers"
:
service
[
"config"
][
"workers"
],
"image"
:
service
[
"config"
][
"image"
],
"image"
:
service
[
"config"
][
"image"
],
"dynamo"
:
service
[
"config"
][
"dynamo"
],
"dynamo"
:
service
[
"config"
][
"dynamo"
],
...
...
deploy/sdk/src/dynamo/sdk/core/protocol/interface.py
View file @
98a5fab1
...
@@ -17,10 +17,10 @@
...
@@ -17,10 +17,10 @@
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
from
collections
import
defaultdict
from
collections
import
defaultdict
from
enum
import
Enum
,
auto
from
enum
import
Enum
,
auto
from
typing
import
Any
,
Dict
,
Generic
,
List
,
Optional
,
Set
,
Tuple
,
Type
,
TypeVar
,
Union
from
typing
import
Any
,
Dict
,
Generic
,
List
,
Optional
,
Set
,
Tuple
,
Type
,
TypeVar
from
fastapi
import
FastAPI
from
fastapi
import
FastAPI
from
pydantic
import
BaseModel
,
Field
,
f
ield
_validator
from
pydantic
import
BaseModel
,
ConfigDict
,
F
ield
from
dynamo.sdk.core.protocol.deployment
import
Env
from
dynamo.sdk.core.protocol.deployment
import
Env
...
@@ -59,16 +59,13 @@ class DynamoTransport(Enum):
...
@@ -59,16 +59,13 @@ class DynamoTransport(Enum):
class
ResourceConfig
(
BaseModel
):
class
ResourceConfig
(
BaseModel
):
"""Configuration for Dynamo resources"""
"""Configuration for Dynamo resources"""
# auto convert gpu and cpu values to string from int
model_config
=
ConfigDict
(
coerce_numbers_to_str
=
True
)
cpu
:
str
=
Field
(
default
=
"1"
)
cpu
:
str
=
Field
(
default
=
"1"
)
memory
:
str
=
Field
(
default
=
"500Mi"
)
memory
:
str
=
Field
(
default
=
"500Mi"
)
gpu
:
str
=
Field
(
default
=
"0"
)
gpu
:
str
=
Field
(
default
=
"0"
)
@
field_validator
(
"gpu"
,
mode
=
"before"
)
@
classmethod
def
convert_gpu_to_string
(
cls
,
v
:
Union
[
str
,
int
])
->
str
:
"""Convert gpu value to string if it's an integer"""
return
str
(
v
)
class
ServiceConfig
(
BaseModel
):
class
ServiceConfig
(
BaseModel
):
"""Base service configuration that can be extended by adapters"""
"""Base service configuration that can be extended by adapters"""
...
...
examples/hello_world/hello_world.py
View file @
98a5fab1
...
@@ -67,7 +67,7 @@ class ResponseType(BaseModel):
...
@@ -67,7 +67,7 @@ class ResponseType(BaseModel):
dynamo
=
{
dynamo
=
{
"namespace"
:
"inference"
,
"namespace"
:
"inference"
,
},
},
resource
=
{
"cpu"
:
1
,
"memory"
:
"500Mi"
},
resource
s
=
{
"cpu"
:
1
,
"memory"
:
"500Mi"
},
workers
=
2
,
workers
=
2
,
image
=
DYNAMO_IMAGE
,
image
=
DYNAMO_IMAGE
,
)
)
...
...
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