-
Notifications
You must be signed in to change notification settings - Fork 43
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(dfir_rs, hydro_lang): add resolve_futures and resolve_futures_ordered APIs #1741
base: main
Are you sure you want to change the base?
Conversation
e64adca
to
d9bc803
Compare
hydro_lang/src/stream.rs
Outdated
/// # use dfir_rs::futures::StreamExt; | ||
/// # use hydro_lang::*; | ||
/// # tokio_test::block_on(test_util::stream_transform_test( | ||
/// |process| { |
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.
Ah, like the other doctests, you should move this line above, and also #
out the assertion and only display a comment instead.
7fa6e13
to
6f604f7
Compare
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.
Couple tweaks needed to the docs, implementation looks great!
hydro_lang/src/stream.rs
Outdated
/// # use dfir_rs::futures::StreamExt; | ||
/// # use hydro_lang::*; | ||
/// # tokio_test::block_on(test_util::stream_transform_test(|process| { | ||
/// let tick = process.tick(); |
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.
You'll want to dedent these (you can hover over the function name in VSCode to see the rendered docs.
hydro_lang/src/stream.rs
Outdated
/// x | ||
/// })) | ||
/// .poll_futures() | ||
/// // 1, 2, 3, 4, 5, 6, 7, 8, 9 |
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.
Just to mirror the other docs, this should be next to the assertion.
hydro_lang/src/stream.rs
Outdated
/// # |mut stream| async move { | ||
/// # assert_eq!( | ||
/// # HashSet::<i32>::from_iter(1..10), | ||
/// # HashSet::from_iter(vec![stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap(), stream.next().await.unwrap()]) |
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.
Can we use a for loop? :)
hydro_lang/src/stream.rs
Outdated
/// x | ||
/// })) | ||
/// .poll_futures_ordered() | ||
/// // 2, 3, 1, 9, 6, 5, 4, 7, 8 |
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 comments as above
process | ||
.source_iter(q!([2, 3, 1, 9, 6, 5, 4, 7, 8])) | ||
.map(q!(|x| async move { | ||
// tokio::time::sleep works, import then just sleep does not, unsure why |
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.
Very strange... this would indicate that something is wrong with the stageleft
logic... But irrelevant to this PR so okay for now.
Another open question; should we name this |
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.
Last set of changes!
@@ -356,7 +356,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N | |||
|
|||
### Reverted | |||
|
|||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 | |||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 |
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.
Ah, looks like a buggy global find-and-replace, we should restore the original file.
@@ -413,7 +413,7 @@ Pipeline flags: Needs checking of bounded vs unbounded for batch()vs all_once()N | |||
|
|||
### Reverted | |||
|
|||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 | |||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 |
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 here.
@@ -1142,7 +1142,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
### Reverted | |||
|
|||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added poll_futures and poll_futures_async operators.", fix #1183 | |||
- <csr-id-256779abece03bee662b351430d27141d10bd5ef/> "feat(hydroflow): Added resolve_futures and resolve_futures_async operators.", fix #1183 |
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.
And here.
/// .resolve_futures() | ||
/// # }, | ||
/// # |mut stream| async move { | ||
/// // 1, 2, 3, 4, 5, 6, 7, 8, 9 |
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.
Can we add a small (in arbitrary order)
note and scramble the order just so developers don't make any assumptions about that?
) | ||
} | ||
|
||
// fn test() { |
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.
leftover?
/// let tick = process.tick(); | ||
/// process.source_iter(q!([2, 3, 1, 9, 6, 5, 4, 7, 8])) | ||
/// .map(q!(|x| async move { | ||
/// // tokio::time::sleep works, import then just sleep does not, unsure why |
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.
Let's not put this inside the test. Also, the reason this happens is that for doctests specifically, we don't have infrastructure to extract the imports used outside the quoted code.
/// let tick = process.tick(); | ||
/// process.source_iter(q!([2, 3, 1, 9, 6, 5, 4, 7, 8])) | ||
/// .map(q!(|x| async move { | ||
/// // tokio::time::sleep works, import then just sleep does not, unsure why |
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 here, let's drop this line.
No description provided.