Skip to content
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

feat: implement Source trait and use it for user-defined source #2114

Merged
merged 13 commits into from
Oct 3, 2024

Conversation

vigith
Copy link
Member

@vigith vigith commented Oct 2, 2024

user-defined source over Source Trait

vigith added 4 commits October 2, 2024 08:37
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
@vigith vigith requested review from BulkBeing and yhl25 October 2, 2024 18:26
@vigith vigith self-assigned this Oct 2, 2024
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 96.08696% with 9 lines in your changes missing coverage. Please review.

Project coverage is 63.96%. Comparing base (3dbed43) to head (d99e1dd).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
rust/numaflow-core/src/source/user_defined.rs 89.36% 5 Missing ⚠️
rust/numaflow-core/src/shared/server_info.rs 98.49% 2 Missing ⚠️
rust/numaflow-core/src/monovertex/forwarder.rs 95.00% 1 Missing ⚠️
rust/numaflow-core/src/reader.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2114      +/-   ##
==========================================
- Coverage   64.25%   63.96%   -0.30%     
==========================================
  Files         324      325       +1     
  Lines       30650    31186     +536     
==========================================
+ Hits        19695    19947     +252     
- Misses       9913    10200     +287     
+ Partials     1042     1039       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

use crate::monovertex::source_pb::{read_response, AckRequest};
use crate::monovertex::sourcetransform_pb::SourceTransformRequest;
use crate::monovertex::{source_pb, sourcetransform_pb};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, I saw a lot of formatting changes in the PR, how did you generate those? asking because I ran cargo fmt in my last PR and it didn't generate your changes. is it because we are using different formatting scheme?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do "cargo fmt" right before committing.

@@ -365,8 +366,8 @@ struct TimestampedPending {
/// `LagReader` is responsible for periodically checking the lag of the source client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please update comments

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

absolutely 😄

@vigith vigith marked this pull request as ready for review October 3, 2024 01:57
@vigith vigith requested a review from whynowy as a code owner October 3, 2024 01:57
Signed-off-by: Vigith Maurice <[email protected]>
Comment on lines 148 to 149
let (source_reader, lag_reader) = new_source(source_grpc_client.clone(), 500, 100).await?;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment about the numbers 500 and 100? use constants.

Comment on lines 307 to 309

let mut source = Source::new(client)
let (mut source, mut lagreader) = new_source(client, 5, 1000)
.await
Copy link
Contributor

@yhl25 yhl25 Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is confusing, method name is new_source but its creating a source as well as lag_reader

Comment on lines +858 to +859
500,
100,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to make it a constant, since its used in multiple places

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we fetch it from the config?

Comment on lines 164 to 166
// start the lag reader to publish lag metrics
let mut lag_reader = utils::create_lag_reader(source_grpc_client.clone()).await;
let mut lag_reader = utils::create_lag_reader(lag_reader).await;
lag_reader.start().await;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we pass lag_reader inside create_lag_reader method, which is confusing

Comment on lines +369 to +370
pub(crate) struct PendingReader<T> {
lag_reader: T,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a lag_reader inside PendingReader which is confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lag_reader is the trait. any recommendation?

rust/numaflow-core/src/source/user_defined.rs Outdated Show resolved Hide resolved
Signed-off-by: Vigith Maurice <[email protected]>

Co-authored-by: Yashash H L <[email protected]>
@@ -117,7 +143,7 @@ impl Source {
.await
.map_err(|e| SourceError(e.to_string()))?;

let mut messages = Vec::with_capacity(num_records as usize);
let mut messages = Vec::with_capacity(self.num_records as usize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.num_records is usize

Signed-off-by: Vigith Maurice <[email protected]>

Co-authored-by: Sreekanth <[email protected]>
Comment on lines 34 to 36
let ud_src = UserDefinedSource::new(client.clone(), num_records, timeout_in_ms)
.await
.map_err(|e| e)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let ud_src = UserDefinedSource::new(client.clone(), num_records, timeout_in_ms)
.await
.map_err(|e| e)?;
let ud_src = UserDefinedSource::new(client.clone(), num_records, timeout_in_ms).await?;

yhl25 added 2 commits October 3, 2024 10:02
Signed-off-by: Yashash H L <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
@yhl25 yhl25 merged commit dc25c4d into main Oct 3, 2024
28 checks passed
@yhl25 yhl25 deleted the source-trait branch October 3, 2024 06:44
SaniyaKalamkar pushed a commit to SaniyaKalamkar/numaflow that referenced this pull request Jan 19, 2025
…proj#2114)

Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Yashash H L <[email protected]>
Co-authored-by: Yashash H L <[email protected]>
Co-authored-by: Sreekanth <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants