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
81162dfe
Unverified
Commit
81162dfe
authored
Oct 07, 2025
by
Graham King
Committed by
GitHub
Oct 07, 2025
Browse files
chore(discovery): Watch/publish ModelDeploymentCard instead of ModelEntry (#3350)
Signed-off-by:
Graham King
<
grahamk@nvidia.com
>
parent
ddbb4f50
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
lib/runtime/src/storage/key_value_store/etcd.rs
lib/runtime/src/storage/key_value_store/etcd.rs
+5
-2
lib/runtime/src/utils/typed_prefix_watcher.rs
lib/runtime/src/utils/typed_prefix_watcher.rs
+3
-3
lib/runtime/src/utils/worker_monitor.rs
lib/runtime/src/utils/worker_monitor.rs
+9
-8
No files found.
lib/runtime/src/storage/key_value_store/etcd.rs
View file @
81162dfe
...
@@ -149,7 +149,7 @@ impl EtcdBucket {
...
@@ -149,7 +149,7 @@ impl EtcdBucket {
tracing
::
trace!
(
"etcd create: {k}"
);
tracing
::
trace!
(
"etcd create: {k}"
);
// Use atomic transaction to check and create in one operation
// Use atomic transaction to check and create in one operation
let
put_options
=
PutOptions
::
new
();
let
put_options
=
PutOptions
::
new
()
.with_lease
(
self
.client
.primary_lease
()
.id
())
;
// Build transaction that creates key only if it doesn't exist
// Build transaction that creates key only if it doesn't exist
let
txn
=
Txn
::
new
()
let
txn
=
Txn
::
new
()
...
@@ -217,9 +217,12 @@ impl EtcdBucket {
...
@@ -217,9 +217,12 @@ impl EtcdBucket {
// So we do too in etcd.
// So we do too in etcd.
}
}
let
put_options
=
PutOptions
::
new
()
.with_lease
(
self
.client
.primary_lease
()
.id
())
.with_prev_key
();
let
mut
put_resp
=
self
let
mut
put_resp
=
self
.client
.client
.kv_put_with_options
(
k
,
value
,
Some
(
P
ut
O
ptions
::
new
()
.with_prev_key
()
))
.kv_put_with_options
(
k
,
value
,
Some
(
p
ut
_o
ptions
))
.await
.await
.map_err
(|
e
|
StorageError
::
EtcdError
(
e
.to_string
()))
?
;
.map_err
(|
e
|
StorageError
::
EtcdError
(
e
.to_string
()))
?
;
Ok
(
match
put_resp
.take_prev_key
()
{
Ok
(
match
put_resp
.take_prev_key
()
{
...
...
lib/runtime/src/utils/typed_prefix_watcher.rs
View file @
81162dfe
...
@@ -67,12 +67,12 @@ where
...
@@ -67,12 +67,12 @@ where
///
///
/// # Example
/// # Example
/// ```ignore
/// ```ignore
/// // Watch for Model
Entry
objects and extract runtime_config field
/// // Watch for Model
DeploymentCard
objects and extract runtime_config field
/// let watcher = watch_prefix_with_extraction(
/// let watcher = watch_prefix_with_extraction(
/// etcd_client,
/// etcd_client,
/// "m
odels
/",
/// "m
dc
/",
/// |kv| Some(kv.lease()), // Use lease_id as key
/// |kv| Some(kv.lease()), // Use lease_id as key
/// |
entry
: Model
Entry| entry
.runtime_config, // Extract runtime_config field
/// |
card
: Model
DeploymentCard| card
.runtime_config, // Extract runtime_config field
/// cancellation_token,
/// cancellation_token,
/// ).await?;
/// ).await?;
/// ```
/// ```
...
...
lib/runtime/src/utils/worker_monitor.rs
View file @
81162dfe
...
@@ -16,7 +16,6 @@ use tokio_stream::StreamExt;
...
@@ -16,7 +16,6 @@ use tokio_stream::StreamExt;
// Constants for monitoring configuration
// Constants for monitoring configuration
const
KV_METRICS_SUBJECT
:
&
str
=
"kv_metrics"
;
const
KV_METRICS_SUBJECT
:
&
str
=
"kv_metrics"
;
const
MODEL_ROOT_PATH
:
&
str
=
"models"
;
// Internal structs for deserializing metrics events
// Internal structs for deserializing metrics events
#[derive(serde::Deserialize)]
#[derive(serde::Deserialize)]
...
@@ -35,11 +34,6 @@ struct KvStats {
...
@@ -35,11 +34,6 @@ struct KvStats {
kv_active_blocks
:
u64
,
kv_active_blocks
:
u64
,
}
}
#[derive(serde::Deserialize)]
struct
ModelEntry
{
runtime_config
:
Option
<
RuntimeConfig
>
,
}
#[derive(serde::Deserialize)]
#[derive(serde::Deserialize)]
struct
RuntimeConfig
{
struct
RuntimeConfig
{
total_kv_blocks
:
Option
<
u64
>
,
total_kv_blocks
:
Option
<
u64
>
,
...
@@ -95,11 +89,18 @@ impl WorkerMonitor {
...
@@ -95,11 +89,18 @@ impl WorkerMonitor {
return
Ok
(());
return
Ok
(());
};
};
// WorkerMonitor is in the wrong crate. It deals with LLM things (KV) so it should be in
// dynamo-llm not dynamo-runtime.
// That means we cannot use ModelDeploymentCard, so use serde_json::Value for now .
let
runtime_configs_watcher
=
watch_prefix_with_extraction
(
let
runtime_configs_watcher
=
watch_prefix_with_extraction
(
etcd_client
,
etcd_client
,
MODEL_ROOT_PATH
,
"mdc/"
,
// should be model_card::ROOT_PREFIX but wrong crate
key_extractors
::
lease_id
,
key_extractors
::
lease_id
,
|
entry
:
ModelEntry
|
entry
.runtime_config
.and_then
(|
rc
|
rc
.total_kv_blocks
),
|
card
:
serde_json
::
Value
|
{
card
.get
(
"runtime_config"
)
.and_then
(|
rc
|
rc
.get
(
"total_kv_blocks"
))
.and_then
(|
t_kv
|
t_kv
.as_u64
())
},
component
.drt
()
.child_token
(),
component
.drt
()
.child_token
(),
)
)
.await
?
;
.await
?
;
...
...
Prev
1
2
Next
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