-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make serving config compatible with numaflow-core configs #2291
Conversation
Signed-off-by: Sreekanth <[email protected]>
Signed-off-by: Sreekanth <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2291 +/- ##
==========================================
+ Coverage 65.49% 65.76% +0.27%
==========================================
Files 346 346
Lines 42394 42767 +373
==========================================
+ Hits 27764 28127 +363
- Misses 13560 13562 +2
- Partials 1070 1078 +8 ☔ View full report in Codecov by Sentry. |
env::var(ENV_NUMAFLOW_SERVING_JETSTREAM_PASSWORD), | ||
) { | ||
(Ok(user), Ok(password)) => { | ||
let js_client = match js_config.auth.as_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will go away eventually right? we will directly write to ISB via the pipeline framework.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for now I'm trying to get it to a working state with minimal changes.
Signed-off-by: Sreekanth <[email protected]>
Signed-off-by: Sreekanth <[email protected]>
Signed-off-by: Sreekanth <[email protected]>
if let Some(ttl) = cfg.store.ttl { | ||
if ttl.is_negative() { | ||
return Err(Error::Config(format!( | ||
"TTL value for Redis store can not be negative. Provided value = {ttl:?}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"TTL value for Redis store can not be negative. Provided value = {ttl:?}" | |
"TTL value for the store can not be negative. Provided value = {ttl:?}" |
removed the word Redis
because DDB
night come too.
const NUMAFLOW_RESP_ARRAY_LEN: &str = "Numaflow-Array-Len"; | ||
const NUMAFLOW_RESP_ARRAY_IDX_LEN: &str = "Numaflow-Array-Index-Len"; | ||
|
||
#[derive(Clone)] | ||
struct ProxyState<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't the state need to be Clone
anymore? make sure it is a cheap clone if there is a need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The router now takes Arc<ProxyState>
as the state.
|
||
if let Err(e) = publish_to_jetstream( | ||
proxy_state.stream, | ||
proxy_state.stream.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this clone too much for every request? we know that String
is a const
since it is stream name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, a lot of clones are happening for Router states. I will work on a separate PR to avoid those. Need to figure out whether to use Arc
of the struct or Arc
of individual fields, some handlers only need part of the application state. Since config lives for the duration of the application, we could make all strings to &'static str
with Box::leak
to avoid all cloning or use Arc<str>
instead of String
for cheaper cloning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do as a follow up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
) | ||
.await | ||
{ | ||
// Deregister the ID in the callback proxy state if writing to Jetstream fails | ||
let _ = proxy_state.callback.deregister(&id).await; | ||
let _ = proxy_state.callback.clone().deregister(&id).await; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for callback.clone
const ENV_NUMAFLOW_SERVING_HOST_IP: &str = "NUMAFLOW_SERVING_HOST_IP"; | ||
const ENV_NUMAFLOW_SERVING_APP_PORT: &str = "NUMAFLOW_SERVING_APP_LISTEN_PORT"; | ||
const ENV_NUMAFLOW_SERVING_JETSTREAM_USER: &str = "NUMAFLOW_ISBSVC_JETSTREAM_USER"; | ||
const ENV_NUMAFLOW_SERVING_JETSTREAM_PASSWORD: &str = "NUMAFLOW_ISBSVC_JETSTREAM_PASSWORD"; | ||
const ENV_NUMAFLOW_SERVING_AUTH_TOKEN: &str = "NUMAFLOW_SERVING_AUTH_TOKEN"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
create a mod called serving and move serving items there? config is getting bloated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the serving::config
module. As of now, it not that big. I think single module is fine for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coverage is getting low
Signed-off-by: Sreekanth <[email protected]>
Signed-off-by: Sreekanth <[email protected]>
Closes #2280
Default
trait implementationTested by running the pipeline https://github.com/numaproj/numaproj-demo/blob/main/serving-demo/README.md