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: impl batch map #66

Merged
merged 17 commits into from
Jul 30, 2024
Merged

feat: impl batch map #66

merged 17 commits into from
Jul 30, 2024

Conversation

kohlisid
Copy link
Contributor

@kohlisid kohlisid commented Jul 14, 2024

Sidhant Kohli and others added 9 commits July 14, 2024 12:54
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
Copy link
Member

@vigith vigith left a comment

Choose a reason for hiding this comment

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

also, you can avoid atomics.

src/lib.rs Outdated Show resolved Hide resolved
Comment on lines +123 to +126
/// # Arguments
///
/// * `value` - A vector of bytes representing the message's payload.
///
Copy link
Member

Choose a reason for hiding this comment

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

is this a standard way of doc? check axum, tokio.

src/batchmap.rs Outdated Show resolved Hide resolved
src/batchmap.rs Outdated Show resolved Hide resolved
Sidhant Kohli added 2 commits July 18, 2024 01:40
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
@kohlisid kohlisid requested a review from vigith July 18, 2024 08:47
@vigith vigith requested review from BulkBeing and yhl25 July 18, 2024 16:19
@vigith vigith marked this pull request as ready for review July 19, 2024 00:40
src/batchmap.rs Outdated
let shutdown_tx = self._shutdown_tx.clone();

// counter to keep track of the number of messages received
let counter_orig = Arc::new(AtomicUsize::new(0));
Copy link
Member

Choose a reason for hiding this comment

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

we dont need this, there is a natural barrier.. make your spawn return the count and compare that in the next

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the case where the user returns from the UDF function early before consuming all the messages on the channel, in such a scenario we would need this right?

Copy link
Member

Choose a reason for hiding this comment

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

That should be fine, because you are awaiting on the spawned task so it won't exit.. perhaps do a select! to force the selection since returning early is not right.

/// use numaflow::batchmap::Message;
/// let message = Message::new(vec![1, 2, 3]).keys(vec!["key1".to_string(), "key2".to_string()]);
/// ```
pub fn keys(mut self, keys: Vec<String>) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The conventions for builder pattern is to have a with_ prefix for methods eg. pub fn with_keys(mut self, keys: Vec<String>) -> Self

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead with the style followed in the current map code

impl Message {

Based on what we want to go forward with it would be good to keep it consistent throughout then.

src/batchmap.rs Outdated Show resolved Hide resolved
src/batchmap.rs Outdated Show resolved Hide resolved
src/batchmap.rs Outdated
let shutdown = shutdown_signal(
internal_shutdown_rx,
Some(shutdown_rx),
CancellationToken::new(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

The CancellationToken is intended to cancel the tasks spawned by the BatchMapService when the Grpc server gets a shutdown signal. It seems only Reducer implementation uses it as of now. We might want to start implementing it for all.

Copy link
Member

Choose a reason for hiding this comment

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

that is right, we need to do for rest.

@kohlisid kohlisid marked this pull request as draft July 23, 2024 01:24
Sidhant Kohli added 2 commits July 22, 2024 18:27
Signed-off-by: Sidhant Kohli <[email protected]>
Signed-off-by: Sidhant Kohli <[email protected]>
@kohlisid kohlisid requested a review from BulkBeing July 23, 2024 16:48
.
Signed-off-by: Sidhant Kohli <[email protected]>
@kohlisid kohlisid requested a review from vigith July 23, 2024 17:11
Signed-off-by: Vigith Maurice <[email protected]>
@vigith vigith marked this pull request as ready for review July 27, 2024 20:54
kohlisid and others added 2 commits July 29, 2024 20:22
@kohlisid kohlisid merged commit e640ac1 into numaproj:main Jul 30, 2024
2 checks passed
@kohlisid kohlisid deleted the batch-map branch July 30, 2024 04:16
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.

Rust-SDK single-server info for map Rust SDK for BatchMap
5 participants