-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adding Combination Operators Zip
, CombineLatest
, WithLatestFrom
#330
base: branch-23.07
Are you sure you want to change the base?
Adding Combination Operators Zip
, CombineLatest
, WithLatestFrom
#330
Conversation
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.
Approved, but I'm not familiar enough with most of the MRC aspects yet to give a thorough review.
@@ -824,6 +1012,182 @@ TEST_F(TestEdges, CombineLatest) | |||
source2->run(); | |||
|
|||
sink->run(); | |||
|
|||
EXPECT_EQ(sink->get_values(), |
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 test doesn't account for all 5 pairs/values that could be yielded in a real scenario where the elements are interleaved, it only accounts for the scenario where source1 is run entirely before source2, meaning we don't get anything except the 2's for source1. Is it worth testing more thoroughly than this?
source1->run(); | ||
|
||
// Should throw when pushing last value | ||
EXPECT_THROW(source2->run(), exceptions::MrcRuntimeError); |
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.
question: Is this going to cause us to throw when we try to shutdown the pipeline? Is that something we want?
|
||
sink->run(); | ||
|
||
EXPECT_EQ(sink->get_values(), |
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.
question: This differs from the previous test where we throw an exception. Why is that? Is it because we treat sink 0 and sink 1 differently in terms of the number of elements they are allowed to accept?
// Push 2 from each | ||
source2->push(2); | ||
source1->push(2); | ||
source3->push(2); | ||
|
||
// Push 2 from each | ||
source2->push(2); | ||
source1->push(2); | ||
source3->push(2); | ||
|
||
// Push the rest | ||
source3->run(); | ||
source1->run(); | ||
source2->run(); | ||
|
||
sink->run(); | ||
|
||
EXPECT_EQ(sink->get_values(), | ||
(std::vector<std::tuple<int, float, std::string>>{ | ||
std::tuple<int, float, std::string>{0, 1, "a"}, | ||
std::tuple<int, float, std::string>{1, 1, "a"}, | ||
std::tuple<int, float, std::string>{2, 3, "b"}, | ||
std::tuple<int, float, std::string>{3, 3, "b"}, | ||
std::tuple<int, float, std::string>{4, 3, "e"}, | ||
})); |
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.
remark: the only thing I'm fuzzy on is whether 0, 1, a
should be in the output, since 0 _ _
was emitted before we had both _ 1 _
and _ _ a
.
question: are we suppose to remember and emit for all values of the source observable, or just the ones that occur after we've received at least one from the others?
template <size_t N> | ||
channel::Status set_upstream_value(NthTypeOf<N, TypesT...> value) | ||
{ | ||
std::unique_lock<decltype(m_mutex)> lock(m_mutex); |
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.
std::unique_lock<decltype(m_mutex)> lock(m_mutex); | |
auto lock = std::unique_lock(m_mutex); |
|
||
void edge_complete() | ||
{ | ||
std::unique_lock<decltype(m_mutex)> lock(m_mutex); |
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.
std::unique_lock<decltype(m_mutex)> lock(m_mutex); | |
auto lock = std::unique_lock(m_mutex); |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## branch-23.07 #330 +/- ##
===============================================
Coverage ? 73.26%
===============================================
Files ? 386
Lines ? 13533
Branches ? 1024
===============================================
Hits ? 9915
Misses ? 3618
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Description
This adds a few new operators for combining multiple streams into one. For example, the code below illustrates using the
Zip
operatorChecklist