Unverified Commit 6f9be594 authored by atchernych's avatar atchernych Committed by GitHub
Browse files

feat: remove component parameter from EPP (#3831)


Signed-off-by: default avatarAnna Tchernych <atchernych@nvidia.com>
Signed-off-by: default avataratchernych <atchernych@nvidia.com>
Co-authored-by: default avatarcoderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
parent 3df1e8c2
......@@ -18,7 +18,6 @@
{{- $useDynamo := default false .Values.epp.useDynamo -}}
{{- $dynNsAll := default .Values.dynamoNamespace .Values.epp.dynamo.namespace -}}
{{- $ns := ternary (required "set epp.dynamo.namespace (or top-level dynamoNamespace) when epp.useDynamo=true" $dynNsAll) "" $useDynamo -}}
{{- $comp := default "backend" .Values.epp.dynamo.component -}}
{{- $kv := default "16" .Values.epp.dynamo.kvBlockSize -}}
{{- $std := .Values.extension.standardImage -}}
{{- $dyn := .Values.extension.dynamoImage -}}
......@@ -94,8 +93,6 @@ spec:
value: "nats://{{ $platformName }}-nats.{{ $platformNs }}:4222"
- name: DYN_NAMESPACE
value: "{{ $ns }}"
- name: DYNAMO_COMPONENT
value: "{{ $comp }}"
- name: DYNAMO_KV_BLOCK_SIZE
value: "{{ $kv }}"
- name: DYNAMO_ROUTER_REPLICA_SYNC
......
......@@ -73,7 +73,6 @@ epp:
configFile: "/etc/epp/epp-config-dynamo.yaml"
dynamo:
namespace: "vllm-agg" # Required when useDynamo: true.
component: "backend"
kvBlockSize: "16"
# Platform configuration (for Dynamo mode)
......
......@@ -4,6 +4,7 @@
use async_once_cell::OnceCell as AsyncOnceCell;
use libc::c_char;
use once_cell::sync::OnceCell;
use std::borrow::Cow;
use std::ffi::CStr;
use std::sync::atomic::{AtomicU32, Ordering};
......@@ -16,6 +17,25 @@ static DRT: AsyncOnceCell<DistributedRuntime> = AsyncOnceCell::new();
// [FIXME] shouldn't the publisher be instance passing between API calls?
static KV_PUB: OnceCell<KvEventPublisher> = OnceCell::new();
/// Convert a C string pointer to a Rust string, falling back to a default when:
/// - the pointer is NULL,
/// - the bytes are not valid UTF-8,
/// - or the resulting string is empty/whitespace.
#[inline]
unsafe fn cstr_or_default<'a>(ptr: *const c_char, default_val: &'a str) -> Cow<'a, str> {
if ptr.is_null() {
return Cow::from(default_val);
}
match unsafe { CStr::from_ptr(ptr) }
.to_str()
.ok()
.map(|s| s.trim())
{
Some(s) if !s.is_empty() => Cow::from(s.to_owned()),
_ => Cow::from(default_val),
}
}
fn initialize_tracing() {
// Sets up RUST_LOG environment variable for logging while KV Publishing
// Example: os.environ["RUST_LOG"] = "debug"
......@@ -74,13 +94,11 @@ pub unsafe extern "C" fn dynamo_llm_init(
}
};
let component = match unsafe { CStr::from_ptr(component_c_str) }.to_str() {
Ok(s) => s.to_string(),
Err(e) => {
tracing::error!(error = ?e, "Failed to convert C string to Rust string (component)");
return DynamoLlmResult::ERR;
}
};
let component_cow = unsafe { cstr_or_default(component_c_str, "backend") };
if let Cow::Borrowed("backend") = &component_cow {
tracing::info!("defaulting to \"backend\" for component");
}
let component: String = component_cow.into_owned();
match result {
Ok(_) => match KV_PUB.get_or_try_init(move || {
......@@ -408,13 +426,13 @@ pub unsafe extern "C" fn dynamo_create_worker_selection_pipeline(
return DynamoLlmResult::ERR;
}
};
let component = match unsafe { CStr::from_ptr(component_c_str) }.to_str() {
Ok(s) => s.to_owned(),
Err(e) => {
tracing::error!(error = ?e, "bad component");
return DynamoLlmResult::ERR;
}
};
let component_cow = unsafe { cstr_or_default(component_c_str, "backend") };
if let Cow::Borrowed("backend") = &component_cow {
tracing::info!("defaulting to \"backend\" for component");
}
let component: String = component_cow.into_owned();
let model = match unsafe { CStr::from_ptr(model_name_c_str) }.to_str() {
Ok(s) => s.to_owned(),
Err(e) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment